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/patch_options_panel.go | |
parent | a9559a5c8738d6938f8750f0729f077e0842800e (diff) |
autostash changes when pulling file into index
Diffstat (limited to 'pkg/gui/patch_options_panel.go')
-rw-r--r-- | pkg/gui/patch_options_panel.go | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/pkg/gui/patch_options_panel.go b/pkg/gui/patch_options_panel.go index b8e88d903..e51860b43 100644 --- a/pkg/gui/patch_options_panel.go +++ b/pkg/gui/patch_options_panel.go @@ -113,11 +113,21 @@ func (gui *Gui) handlePullPatchIntoWorkingTree() error { return err } - return gui.WithWaitingStatus(gui.Tr.SLocalize("RebasingStatus"), func() error { - commitIndex := gui.getPatchCommitIndex() - err := gui.GitCommand.PullPatchIntoIndex(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager) - return gui.handleGenericMergeCommandResult(err) - }) + pull := func(stash bool) error { + return gui.WithWaitingStatus(gui.Tr.SLocalize("RebasingStatus"), func() error { + commitIndex := gui.getPatchCommitIndex() + err := gui.GitCommand.PullPatchIntoIndex(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager, stash) + return gui.handleGenericMergeCommandResult(err) + }) + } + + if len(gui.trackedFiles()) > 0 { + return gui.createConfirmationPanel(gui.g, gui.g.CurrentView(), true, gui.Tr.SLocalize("MustStashTitle"), gui.Tr.SLocalize("MustStashWarning"), func(*gocui.Gui, *gocui.View) error { + return pull(true) + }, nil) + } else { + return pull(false) + } } func (gui *Gui) handleApplyPatch() error { |