Skip to content

Commit 5142dc6

Browse files
committed
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.
1 parent 9cbe6cd commit 5142dc6

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

pkg/gui/controllers/custom_patch_options_menu_action.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func (self *CustomPatchOptionsMenuAction) handlePullPatchIntoNewCommit() error {
196196
self.returnFocusFromPatchExplorerIfNecessary()
197197

198198
commitIndex := self.getPatchCommitIndex()
199-
return self.c.Helpers().Commits.OpenCommitMessagePanel(
199+
self.c.Helpers().Commits.OpenCommitMessagePanel(
200200
&helpers.OpenCommitMessagePanelOpts{
201201
// Pass a commit index of one less than the moved-from commit, so that
202202
// you can press up arrow once to recall the original commit message:
@@ -219,6 +219,8 @@ func (self *CustomPatchOptionsMenuAction) handlePullPatchIntoNewCommit() error {
219219
},
220220
},
221221
)
222+
223+
return nil
222224
}
223225

224226
func (self *CustomPatchOptionsMenuAction) handleApplyPatch(reverse bool) error {

pkg/gui/controllers/helpers/commits_helper.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ type OpenCommitMessagePanelOpts struct {
131131
InitialMessage string
132132
}
133133

134-
func (self *CommitsHelper) OpenCommitMessagePanel(opts *OpenCommitMessagePanelOpts) error {
134+
func (self *CommitsHelper) OpenCommitMessagePanel(opts *OpenCommitMessagePanelOpts) {
135135
onConfirm := func(summary string, description string) error {
136136
self.CloseCommitMessagePanel()
137137

@@ -150,7 +150,6 @@ func (self *CommitsHelper) OpenCommitMessagePanel(opts *OpenCommitMessagePanelOp
150150
self.UpdateCommitPanelView(opts.InitialMessage)
151151

152152
self.c.Context().Push(self.c.Contexts().CommitMessage)
153-
return nil
154153
}
155154

156155
func (self *CommitsHelper) OnCommitSuccess() {

pkg/gui/controllers/helpers/tags_helper.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (self *TagsHelper) OpenCreateTagPrompt(ref string, onCreate func()) error {
6666
return doCreateTag(tagName, description, false)
6767
}
6868

69-
return self.commitsHelper.OpenCommitMessagePanel(
69+
self.commitsHelper.OpenCommitMessagePanel(
7070
&OpenCommitMessagePanelOpts{
7171
CommitIndex: context.NoCommitIndex,
7272
InitialMessage: "",
@@ -76,4 +76,6 @@ func (self *TagsHelper) OpenCreateTagPrompt(ref string, onCreate func()) error {
7676
OnConfirm: onConfirm,
7777
},
7878
)
79+
80+
return nil
7981
}

pkg/gui/controllers/helpers/working_tree_helper.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (self *WorkingTreeHelper) OpenMergeTool() error {
8888

8989
func (self *WorkingTreeHelper) HandleCommitPressWithMessage(initialMessage string) error {
9090
return self.WithEnsureCommitableFiles(func() error {
91-
return self.commitsHelper.OpenCommitMessagePanel(
91+
self.commitsHelper.OpenCommitMessagePanel(
9292
&OpenCommitMessagePanelOpts{
9393
CommitIndex: context.NoCommitIndex,
9494
InitialMessage: initialMessage,
@@ -99,6 +99,8 @@ func (self *WorkingTreeHelper) HandleCommitPressWithMessage(initialMessage strin
9999
OnSwitchToEditor: self.switchFromCommitMessagePanelToEditor,
100100
},
101101
)
102+
103+
return nil
102104
})
103105
}
104106

pkg/gui/controllers/local_commits_controller.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ func (self *LocalCommitsController) reword(commit *models.Commit) error {
366366
if self.c.UserConfig().Git.Commit.AutoWrapCommitMessage {
367367
commitMessage = helpers.TryRemoveHardLineBreaks(commitMessage, self.c.UserConfig().Git.Commit.AutoWrapWidth)
368368
}
369-
return self.c.Helpers().Commits.OpenCommitMessagePanel(
369+
self.c.Helpers().Commits.OpenCommitMessagePanel(
370370
&helpers.OpenCommitMessagePanelOpts{
371371
CommitIndex: self.context().GetSelectedLineIdx(),
372372
InitialMessage: commitMessage,
@@ -377,6 +377,8 @@ func (self *LocalCommitsController) reword(commit *models.Commit) error {
377377
OnSwitchToEditor: self.switchFromCommitMessagePanelToEditor,
378378
},
379379
)
380+
381+
return nil
380382
}
381383

382384
func (self *LocalCommitsController) switchFromCommitMessagePanelToEditor(filepath string) error {
@@ -931,7 +933,7 @@ func (self *LocalCommitsController) createAmendCommit(commit *models.Commit, inc
931933
commitMessage = helpers.TryRemoveHardLineBreaks(commitMessage, self.c.UserConfig().Git.Commit.AutoWrapWidth)
932934
}
933935
originalSubject, _, _ := strings.Cut(commitMessage, "\n")
934-
return self.c.Helpers().Commits.OpenCommitMessagePanel(
936+
self.c.Helpers().Commits.OpenCommitMessagePanel(
935937
&helpers.OpenCommitMessagePanelOpts{
936938
CommitIndex: self.context().GetSelectedLineIdx(),
937939
InitialMessage: commitMessage,
@@ -952,6 +954,8 @@ func (self *LocalCommitsController) createAmendCommit(commit *models.Commit, inc
952954
OnSwitchToEditor: nil,
953955
},
954956
)
957+
958+
return nil
955959
}
956960

957961
func (self *LocalCommitsController) squashFixupCommits() error {

0 commit comments

Comments
 (0)