summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-03-30 08:49:20 +1100
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2020-03-29 21:53:25 +0000
commit97d7a8ad0c241192a8909b6c7bea5444dc9206d1 (patch)
tree91b8b96ece26a9357331f624649de2fc4f0b4345
parentb89ba365d0fb86f73ca25ad2ec0ed3fa86993ee6 (diff)
add reverse patch option
-rw-r--r--pkg/gui/patch_options_panel.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkg/gui/patch_options_panel.go b/pkg/gui/patch_options_panel.go
index 046f89b68..b69d12d92 100644
--- a/pkg/gui/patch_options_panel.go
+++ b/pkg/gui/patch_options_panel.go
@@ -22,7 +22,11 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error
},
{
displayString: "apply patch",
- onPress: gui.handleApplyPatch,
+ onPress: func() error { return gui.handleApplyPatch(false) },
+ },
+ {
+ displayString: "apply patch in reverse",
+ onPress: func() error { return gui.handleApplyPatch(true) },
},
{
displayString: "reset patch",
@@ -133,12 +137,12 @@ func (gui *Gui) handlePullPatchIntoWorkingTree() error {
}
}
-func (gui *Gui) handleApplyPatch() error {
+func (gui *Gui) handleApplyPatch(reverse bool) error {
if err := gui.returnFocusFromLineByLinePanelIfNecessary(); err != nil {
return err
}
- if err := gui.GitCommand.PatchManager.ApplyPatches(false); err != nil {
+ if err := gui.GitCommand.PatchManager.ApplyPatches(reverse); err != nil {
return gui.surfaceError(err)
}
return gui.refreshSidePanels(refreshOptions{mode: ASYNC})