Skip to content

Commit e354dd3

Browse files
stefanhaller2KAbhishek
authored andcommitted
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 cf0ee2e commit e354dd3

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
@@ -215,9 +215,12 @@ func (self *CommitsHelper) addCoAuthor(suggestionFunc func(string) []*types.Sugg
215215
Title: self.c.Tr.AddCoAuthorPromptTitle,
216216
FindSuggestionsFunc: suggestionFunc,
217217
HandleConfirm: func(value string) error {
218-
commitMessage := self.JoinCommitMessageAndDescription()
219-
coAuthorString := commitMessage + "\nCo-authored-by: " + value
220-
self.SetMessageAndDescriptionInView(coAuthorString)
218+
commitDescription := self.getCommitDescription()
219+
if len(commitDescription) != 0 {
220+
commitDescription += "\n\n"
221+
}
222+
commitDescription += "Co-authored-by: " + value
223+
self.setCommitDescription(commitDescription)
221224
return nil
222225
},
223226
})

0 commit comments

Comments
 (0)