Skip to content

Commit 9a1ae9a

Browse files
ltuikovJunio C Hamano
authored andcommitted
sample commit-msg hook: no silent exit on duplicate Signed-off-by lines
git-commit would silently exit if duplicate Signed-off-by lines were found. Users of git-commit would not know it, unless they checked '$?'. This patch makes git-commit actually print out a message that nothing was commited since duplicate Signed-off-lines were found. Signed-off-by: Luben Tuikov <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e77235e commit 9a1ae9a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

templates/hooks--commit-msg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@
1111
# This example catches duplicate Signed-off-by lines.
1212

1313
test "" = "$(grep '^Signed-off-by: ' "$1" |
14-
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')"
14+
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
15+
echo >&2 Duplicate Signed-off-by lines.
16+
exit 1
17+
}
18+

0 commit comments

Comments
 (0)