mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-13 01:30:53 +02:00
allow applying patch directly
This commit is contained in:
@ -20,6 +20,10 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error
|
|||||||
displayString: "pull patch out into index",
|
displayString: "pull patch out into index",
|
||||||
onPress: gui.handlePullPatchIntoWorkingTree,
|
onPress: gui.handlePullPatchIntoWorkingTree,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayString: "apply patch",
|
||||||
|
onPress: gui.handleApplyPatch,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayString: "reset patch",
|
displayString: "reset patch",
|
||||||
onPress: gui.handleResetPatch,
|
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 {
|
func (gui *Gui) handleResetPatch() error {
|
||||||
gui.GitCommand.PatchManager.Reset()
|
gui.GitCommand.PatchManager.Reset()
|
||||||
return gui.refreshCommitFilesView()
|
return gui.refreshCommitFilesView()
|
||||||
|
Reference in New Issue
Block a user