diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-26 21:00:08 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-26 21:44:45 +1100 |
commit | 95b147079f2a232d9fa260f9db36859b53145a96 (patch) | |
tree | acd365e8c288929f6f6e59cb9aee2e00eae52ba1 /pkg/gui | |
parent | 83757f10658415e48b22e2521885d42b712a5e37 (diff) |
allow applying patch directlyv0.18
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/patch_options_panel.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/gui/patch_options_panel.go b/pkg/gui/patch_options_panel.go index 849157598..3d24c2b11 100644 --- a/pkg/gui/patch_options_panel.go +++ b/pkg/gui/patch_options_panel.go @@ -21,6 +21,10 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error onPress: gui.handlePullPatchIntoWorkingTree, }, { + displayString: "apply patch", + onPress: gui.handleApplyPatch, + }, + { displayString: "reset patch", onPress: gui.handleResetPatch, }, @@ -116,6 +120,17 @@ func (gui *Gui) handlePullPatchIntoWorkingTree() error { }) } +func (gui *Gui) handleApplyPatch() error { + if err := gui.returnFocusFromLineByLinePanelIfNecessary(); err != nil { + return err + } + + if err := gui.GitCommand.PatchManager.ApplyPatches(false); err != nil { + return gui.createErrorPanel(gui.g, err.Error()) + } + return gui.refreshSidePanels(gui.g) +} + func (gui *Gui) handleResetPatch() error { gui.GitCommand.PatchManager.Reset() return gui.refreshCommitFilesView() |