1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Remove return value of IContextMgr.Push/Pop et. al.

This commit is contained in:
Stefan Haller
2024-09-04 18:33:48 +02:00
parent 072b465fa6
commit 371998e635
42 changed files with 137 additions and 162 deletions

View File

@ -121,11 +121,10 @@ func (self *CustomPatchOptionsMenuAction) validateNormalWorkingTreeState() (bool
return true, nil
}
func (self *CustomPatchOptionsMenuAction) returnFocusFromPatchExplorerIfNecessary() error {
func (self *CustomPatchOptionsMenuAction) returnFocusFromPatchExplorerIfNecessary() {
if self.c.Context().Current().GetKey() == self.c.Contexts().CustomPatchBuilder.GetKey() {
return self.c.Helpers().PatchBuilding.Escape()
self.c.Helpers().PatchBuilding.Escape()
}
return nil
}
func (self *CustomPatchOptionsMenuAction) handleDeletePatchFromCommit() error {
@ -133,9 +132,7 @@ func (self *CustomPatchOptionsMenuAction) handleDeletePatchFromCommit() error {
return err
}
if err := self.returnFocusFromPatchExplorerIfNecessary(); err != nil {
return err
}
self.returnFocusFromPatchExplorerIfNecessary()
return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(gocui.Task) error {
commitIndex := self.getPatchCommitIndex()
@ -150,9 +147,7 @@ func (self *CustomPatchOptionsMenuAction) handleMovePatchToSelectedCommit() erro
return err
}
if err := self.returnFocusFromPatchExplorerIfNecessary(); err != nil {
return err
}
self.returnFocusFromPatchExplorerIfNecessary()
return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(gocui.Task) error {
commitIndex := self.getPatchCommitIndex()
@ -167,9 +162,7 @@ func (self *CustomPatchOptionsMenuAction) handleMovePatchIntoWorkingTree() error
return err
}
if err := self.returnFocusFromPatchExplorerIfNecessary(); err != nil {
return err
}
self.returnFocusFromPatchExplorerIfNecessary()
pull := func(stash bool) error {
return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(gocui.Task) error {
@ -198,9 +191,7 @@ func (self *CustomPatchOptionsMenuAction) handlePullPatchIntoNewCommit() error {
return err
}
if err := self.returnFocusFromPatchExplorerIfNecessary(); err != nil {
return err
}
self.returnFocusFromPatchExplorerIfNecessary()
commitIndex := self.getPatchCommitIndex()
return self.c.Helpers().Commits.OpenCommitMessagePanel(
@ -214,13 +205,14 @@ func (self *CustomPatchOptionsMenuAction) handlePullPatchIntoNewCommit() error {
PreserveMessage: false,
OnConfirm: func(summary string, description string) error {
return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(gocui.Task) error {
_ = self.c.Helpers().Commits.CloseCommitMessagePanel()
self.c.Helpers().Commits.CloseCommitMessagePanel()
self.c.LogAction(self.c.Tr.Actions.MovePatchIntoNewCommit)
err := self.c.Git().Patch.PullPatchIntoNewCommit(self.c.Model().Commits, commitIndex, summary, description)
if err := self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(err); err != nil {
return err
}
return self.c.Context().Push(self.c.Contexts().LocalCommits)
self.c.Context().Push(self.c.Contexts().LocalCommits)
return nil
})
},
},
@ -228,9 +220,7 @@ func (self *CustomPatchOptionsMenuAction) handlePullPatchIntoNewCommit() error {
}
func (self *CustomPatchOptionsMenuAction) handleApplyPatch(reverse bool) error {
if err := self.returnFocusFromPatchExplorerIfNecessary(); err != nil {
return err
}
self.returnFocusFromPatchExplorerIfNecessary()
action := self.c.Tr.Actions.ApplyPatch
if reverse {