mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-13 05:15:53 +02:00
reset patch builder when we've escaped from the building phase and nothing has been added
This commit is contained in:
parent
d0d92c7697
commit
cd17b46b55
4 changed files with 24 additions and 9 deletions
|
@ -136,7 +136,7 @@ func (gui *Gui) handleToggleFileForPatch(g *gocui.Gui, v *gocui.View) error {
|
|||
}
|
||||
|
||||
toggleTheFile := func() error {
|
||||
if gui.GitCommand.PatchManager.IsEmpty() {
|
||||
if !gui.GitCommand.PatchManager.CommitSelected() {
|
||||
if err := gui.startPatchManager(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ func (gui *Gui) handleToggleFileForPatch(g *gocui.Gui, v *gocui.View) error {
|
|||
return gui.refreshCommitFilesView()
|
||||
}
|
||||
|
||||
if !gui.GitCommand.PatchManager.IsEmpty() && gui.GitCommand.PatchManager.CommitSha != commitFile.Sha {
|
||||
if gui.GitCommand.PatchManager.CommitSelected() && gui.GitCommand.PatchManager.CommitSha != commitFile.Sha {
|
||||
return gui.createConfirmationPanel(g, v, true, gui.Tr.SLocalize("DiscardPatch"), gui.Tr.SLocalize("DiscardPatchConfirm"), func(g *gocui.Gui, v *gocui.View) error {
|
||||
gui.GitCommand.PatchManager.Reset()
|
||||
return toggleTheFile()
|
||||
|
@ -187,7 +187,7 @@ func (gui *Gui) handleEnterCommitFile(g *gocui.Gui, v *gocui.View) error {
|
|||
}
|
||||
|
||||
enterTheFile := func() error {
|
||||
if gui.GitCommand.PatchManager.IsEmpty() {
|
||||
if !gui.GitCommand.PatchManager.CommitSelected() {
|
||||
if err := gui.startPatchManager(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ func (gui *Gui) handleEnterCommitFile(g *gocui.Gui, v *gocui.View) error {
|
|||
return gui.refreshPatchBuildingPanel()
|
||||
}
|
||||
|
||||
if !gui.GitCommand.PatchManager.IsEmpty() && gui.GitCommand.PatchManager.CommitSha != commitFile.Sha {
|
||||
if gui.GitCommand.PatchManager.CommitSelected() && gui.GitCommand.PatchManager.CommitSha != commitFile.Sha {
|
||||
return gui.createConfirmationPanel(g, v, false, gui.Tr.SLocalize("DiscardPatch"), gui.Tr.SLocalize("DiscardPatchConfirm"), func(g *gocui.Gui, v *gocui.View) error {
|
||||
gui.GitCommand.PatchManager.Reset()
|
||||
return enterTheFile()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue