Skip to content

Commit cd3f20d

Browse files
committed
Don't append co-authors to commit message more than once
Let's make sure that the output of `git mob-print` isn't already present in the commit message before we append it. This avoids an issue whereby amending a commit or interactive rebasing could lead to the co-authors being added to the commit message multiple times. It would probably be even better to match each coauthor individually, since coauthors could still be added multiple times if the mob changes, but that's a bigger change and in the mean time this still seems like an improvement. PR: #52
1 parent a6a141d commit cd3f20d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

hook-examples/prepare-commit-msg-nodejs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ if(/COMMIT_EDITMSG/g.test(commitMessage)){
1515
// opens .git/COMMIT_EDITMSG
1616
contents = fs.readFileSync(commitMessage);
1717

18+
if(contents.indexOf(stdout.trim()) !== -1) {
19+
process.exit(0);
20+
}
21+
1822
const commentPos = contents.indexOf('# ');
1923
const gitMessage = contents.slice(0, commentPos);
2024
const gitComments = contents.slice(commentPos)

0 commit comments

Comments
 (0)