1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-17 21:18:31 +02:00

add reverse patch option

This commit is contained in:
Jesse Duffield 2020-03-30 08:49:20 +11:00 committed by github-actions[bot]
parent b89ba365d0
commit 97d7a8ad0c

View File

@ -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})