mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Remove return value of OpenCommitMessagePanel
Similar to the previous commit: in 100% of the call sites we now need an extra `return nil`. Nevertheless, I still prefer it this way.
This commit is contained in:
@ -196,7 +196,7 @@ func (self *CustomPatchOptionsMenuAction) handlePullPatchIntoNewCommit() error {
|
|||||||
self.returnFocusFromPatchExplorerIfNecessary()
|
self.returnFocusFromPatchExplorerIfNecessary()
|
||||||
|
|
||||||
commitIndex := self.getPatchCommitIndex()
|
commitIndex := self.getPatchCommitIndex()
|
||||||
return self.c.Helpers().Commits.OpenCommitMessagePanel(
|
self.c.Helpers().Commits.OpenCommitMessagePanel(
|
||||||
&helpers.OpenCommitMessagePanelOpts{
|
&helpers.OpenCommitMessagePanelOpts{
|
||||||
// Pass a commit index of one less than the moved-from commit, so that
|
// Pass a commit index of one less than the moved-from commit, so that
|
||||||
// you can press up arrow once to recall the original commit message:
|
// you can press up arrow once to recall the original commit message:
|
||||||
@ -219,6 +219,8 @@ func (self *CustomPatchOptionsMenuAction) handlePullPatchIntoNewCommit() error {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *CustomPatchOptionsMenuAction) handleApplyPatch(reverse bool) error {
|
func (self *CustomPatchOptionsMenuAction) handleApplyPatch(reverse bool) error {
|
||||||
|
@ -131,7 +131,7 @@ type OpenCommitMessagePanelOpts struct {
|
|||||||
InitialMessage string
|
InitialMessage string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *CommitsHelper) OpenCommitMessagePanel(opts *OpenCommitMessagePanelOpts) error {
|
func (self *CommitsHelper) OpenCommitMessagePanel(opts *OpenCommitMessagePanelOpts) {
|
||||||
onConfirm := func(summary string, description string) error {
|
onConfirm := func(summary string, description string) error {
|
||||||
self.CloseCommitMessagePanel()
|
self.CloseCommitMessagePanel()
|
||||||
|
|
||||||
@ -150,7 +150,6 @@ func (self *CommitsHelper) OpenCommitMessagePanel(opts *OpenCommitMessagePanelOp
|
|||||||
self.UpdateCommitPanelView(opts.InitialMessage)
|
self.UpdateCommitPanelView(opts.InitialMessage)
|
||||||
|
|
||||||
self.c.Context().Push(self.c.Contexts().CommitMessage)
|
self.c.Context().Push(self.c.Contexts().CommitMessage)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *CommitsHelper) OnCommitSuccess() {
|
func (self *CommitsHelper) OnCommitSuccess() {
|
||||||
|
@ -66,7 +66,7 @@ func (self *TagsHelper) OpenCreateTagPrompt(ref string, onCreate func()) error {
|
|||||||
return doCreateTag(tagName, description, false)
|
return doCreateTag(tagName, description, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return self.commitsHelper.OpenCommitMessagePanel(
|
self.commitsHelper.OpenCommitMessagePanel(
|
||||||
&OpenCommitMessagePanelOpts{
|
&OpenCommitMessagePanelOpts{
|
||||||
CommitIndex: context.NoCommitIndex,
|
CommitIndex: context.NoCommitIndex,
|
||||||
InitialMessage: "",
|
InitialMessage: "",
|
||||||
@ -76,4 +76,6 @@ func (self *TagsHelper) OpenCreateTagPrompt(ref string, onCreate func()) error {
|
|||||||
OnConfirm: onConfirm,
|
OnConfirm: onConfirm,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ func (self *WorkingTreeHelper) OpenMergeTool() error {
|
|||||||
|
|
||||||
func (self *WorkingTreeHelper) HandleCommitPressWithMessage(initialMessage string) error {
|
func (self *WorkingTreeHelper) HandleCommitPressWithMessage(initialMessage string) error {
|
||||||
return self.WithEnsureCommitableFiles(func() error {
|
return self.WithEnsureCommitableFiles(func() error {
|
||||||
return self.commitsHelper.OpenCommitMessagePanel(
|
self.commitsHelper.OpenCommitMessagePanel(
|
||||||
&OpenCommitMessagePanelOpts{
|
&OpenCommitMessagePanelOpts{
|
||||||
CommitIndex: context.NoCommitIndex,
|
CommitIndex: context.NoCommitIndex,
|
||||||
InitialMessage: initialMessage,
|
InitialMessage: initialMessage,
|
||||||
@ -99,6 +99,8 @@ func (self *WorkingTreeHelper) HandleCommitPressWithMessage(initialMessage strin
|
|||||||
OnSwitchToEditor: self.switchFromCommitMessagePanelToEditor,
|
OnSwitchToEditor: self.switchFromCommitMessagePanelToEditor,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ func (self *LocalCommitsController) reword(commit *models.Commit) error {
|
|||||||
if self.c.UserConfig().Git.Commit.AutoWrapCommitMessage {
|
if self.c.UserConfig().Git.Commit.AutoWrapCommitMessage {
|
||||||
commitMessage = helpers.TryRemoveHardLineBreaks(commitMessage, self.c.UserConfig().Git.Commit.AutoWrapWidth)
|
commitMessage = helpers.TryRemoveHardLineBreaks(commitMessage, self.c.UserConfig().Git.Commit.AutoWrapWidth)
|
||||||
}
|
}
|
||||||
return self.c.Helpers().Commits.OpenCommitMessagePanel(
|
self.c.Helpers().Commits.OpenCommitMessagePanel(
|
||||||
&helpers.OpenCommitMessagePanelOpts{
|
&helpers.OpenCommitMessagePanelOpts{
|
||||||
CommitIndex: self.context().GetSelectedLineIdx(),
|
CommitIndex: self.context().GetSelectedLineIdx(),
|
||||||
InitialMessage: commitMessage,
|
InitialMessage: commitMessage,
|
||||||
@ -377,6 +377,8 @@ func (self *LocalCommitsController) reword(commit *models.Commit) error {
|
|||||||
OnSwitchToEditor: self.switchFromCommitMessagePanelToEditor,
|
OnSwitchToEditor: self.switchFromCommitMessagePanelToEditor,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *LocalCommitsController) switchFromCommitMessagePanelToEditor(filepath string) error {
|
func (self *LocalCommitsController) switchFromCommitMessagePanelToEditor(filepath string) error {
|
||||||
@ -931,7 +933,7 @@ func (self *LocalCommitsController) createAmendCommit(commit *models.Commit, inc
|
|||||||
commitMessage = helpers.TryRemoveHardLineBreaks(commitMessage, self.c.UserConfig().Git.Commit.AutoWrapWidth)
|
commitMessage = helpers.TryRemoveHardLineBreaks(commitMessage, self.c.UserConfig().Git.Commit.AutoWrapWidth)
|
||||||
}
|
}
|
||||||
originalSubject, _, _ := strings.Cut(commitMessage, "\n")
|
originalSubject, _, _ := strings.Cut(commitMessage, "\n")
|
||||||
return self.c.Helpers().Commits.OpenCommitMessagePanel(
|
self.c.Helpers().Commits.OpenCommitMessagePanel(
|
||||||
&helpers.OpenCommitMessagePanelOpts{
|
&helpers.OpenCommitMessagePanelOpts{
|
||||||
CommitIndex: self.context().GetSelectedLineIdx(),
|
CommitIndex: self.context().GetSelectedLineIdx(),
|
||||||
InitialMessage: commitMessage,
|
InitialMessage: commitMessage,
|
||||||
@ -952,6 +954,8 @@ func (self *LocalCommitsController) createAmendCommit(commit *models.Commit, inc
|
|||||||
OnSwitchToEditor: nil,
|
OnSwitchToEditor: nil,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *LocalCommitsController) squashFixupCommits() error {
|
func (self *LocalCommitsController) squashFixupCommits() error {
|
||||||
|
Reference in New Issue
Block a user