Skip to content

Commit 0a763e9

Browse files
authored
fix: format generated commits (#451)
When commits are signed off, they are not being formatted correctly. A new line is missing between the title and the sign-off. Before: Commit title Signed off part After the change: Commit title Signed off part Signed-off-by: Filip Mudry <[email protected]>
1 parent 953fdcf commit 0a763e9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/git/github/github_helper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ func (g *GithubClient) addCommitToBranch(owner, repository, authorName, authorEm
238238
return err
239239
}
240240
if signedOff {
241-
commitMessage = fmt.Sprintf("%s\nSigned-off-by: %s <%s>", commitMessage, authorName, authorEmail)
241+
commitMessage = fmt.Sprintf("%s\n\nSigned-off-by: %s <%s>", commitMessage, authorName, authorEmail)
242242
}
243243

244244
// Create the commit using the tree.
@@ -271,7 +271,7 @@ func (g *GithubClient) addDeleteCommitToBranch(owner, repository, authorName, au
271271
return err
272272
}
273273
if signedOff {
274-
commitMessage = fmt.Sprintf("%s\nSigned-off-by: %s <%s>", commitMessage, authorName, authorEmail)
274+
commitMessage = fmt.Sprintf("%s\n\nSigned-off-by: %s <%s>", commitMessage, authorName, authorEmail)
275275
}
276276

277277
// Create the commit using the tree.

pkg/git/gitlab/gitlab_helper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ func (g *GitlabClient) commitFilesIntoBranch(projectPath, branchName, commitMess
270270
actions = append(actions, action)
271271
}
272272
if signedOff {
273-
commitMessage = fmt.Sprintf("%s\nSigned-off-by: %s <%s>", commitMessage, authorName, authorEmail)
273+
commitMessage = fmt.Sprintf("%s\n\nSigned-off-by: %s <%s>", commitMessage, authorName, authorEmail)
274274
}
275275

276276
opts := &gitlab.CreateCommitOptions{
@@ -298,7 +298,7 @@ func (g *GitlabClient) addDeleteCommitToBranch(projectPath, branchName, authorNa
298298
})
299299
}
300300
if signedOff {
301-
commitMessage = fmt.Sprintf("%s\nSigned-off-by: %s <%s>", commitMessage, authorName, authorEmail)
301+
commitMessage = fmt.Sprintf("%s\n\nSigned-off-by: %s <%s>", commitMessage, authorName, authorEmail)
302302
}
303303

304304
opts := &gitlab.CreateCommitOptions{

0 commit comments

Comments
 (0)