mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-17 01:42:45 +02:00
add reverse patch option
This commit is contained in:
committed by
github-actions[bot]
parent
b89ba365d0
commit
97d7a8ad0c
@ -22,7 +22,11 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayString: "apply patch",
|
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",
|
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 {
|
if err := gui.returnFocusFromLineByLinePanelIfNecessary(); err != nil {
|
||||||
return err
|
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.surfaceError(err)
|
||||||
}
|
}
|
||||||
return gui.refreshSidePanels(refreshOptions{mode: ASYNC})
|
return gui.refreshSidePanels(refreshOptions{mode: ASYNC})
|
||||||
|
Reference in New Issue
Block a user