diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-28 12:43:31 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-28 13:19:35 +1100 |
commit | 0c0231c3e835ef93a7fe06a95c28bd00f1da6631 (patch) | |
tree | 50bc70e0a508888b9c370e4cbb0fe82f72dfdc44 /pkg/gui/undoing.go | |
parent | a9559a5c8738d6938f8750f0729f077e0842800e (diff) |
autostash changes when pulling file into index
Diffstat (limited to 'pkg/gui/undoing.go')
-rw-r--r-- | pkg/gui/undoing.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/pkg/gui/undoing.go b/pkg/gui/undoing.go index 9ce7f7b0e..d34bfe91d 100644 --- a/pkg/gui/undoing.go +++ b/pkg/gui/undoing.go @@ -155,15 +155,6 @@ type handleHardResetWithAutoStashOptions struct { // only to be used in the undo flow for now func (gui *Gui) handleHardResetWithAutoStash(commitSha string, options handleHardResetWithAutoStashOptions) error { - // if we have any modified tracked files we need to ask the user if they want us to stash for them - dirtyWorkingTree := false - for _, file := range gui.State.Files { - if file.Tracked { - dirtyWorkingTree = true - break - } - } - reset := func() error { if err := gui.resetToRef(commitSha, "hard", commands.RunCommandOptions{EnvVars: options.EnvVars}); err != nil { return gui.surfaceError(err) @@ -171,6 +162,8 @@ func (gui *Gui) handleHardResetWithAutoStash(commitSha string, options handleHar return nil } + // if we have any modified tracked files we need to ask the user if they want us to stash for them + dirtyWorkingTree := len(gui.trackedFiles()) > 0 if dirtyWorkingTree { // offer to autostash changes return gui.createConfirmationPanel(gui.g, gui.getBranchesView(), true, gui.Tr.SLocalize("AutoStashTitle"), gui.Tr.SLocalize("AutoStashPrompt"), func(g *gocui.Gui, v *gocui.View) error { |