Skip to content

Commit afc2a1a

Browse files
committed
fixup! Add commit menu entry "Add co-author"
No reason to join the subject and description just to split again later. We only want to change the description, so work with that directly. This requires an extra "if" for the case that the description is empty, but I think it's worth it. Also, take this opportunity to add an extra blank line before the Co-authored-by line, like we do when invoking it after the fact.
1 parent e798b59 commit afc2a1a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/gui/controllers/helpers/commits_helper.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,12 @@ func (self *CommitsHelper) addCoAuthor(suggestionFunc func(string) []*types.Sugg
220220
Title: self.c.Tr.AddCoAuthorPromptTitle,
221221
FindSuggestionsFunc: suggestionFunc,
222222
HandleConfirm: func(value string) error {
223-
commitMessage := self.JoinCommitMessageAndDescription()
224-
coAuthorString := commitMessage + "\nCo-authored-by: " + value
225-
self.SetMessageAndDescriptionInView(coAuthorString)
223+
commitDescription := self.getCommitDescription()
224+
if len(commitDescription) != 0 {
225+
commitDescription += "\n\n"
226+
}
227+
commitDescription += "Co-authored-by: " + value
228+
self.setCommitDescription(commitDescription)
226229
return nil
227230
},
228231
})

0 commit comments

Comments
 (0)