Skip to content

Commit

Permalink
sample commit-msg hook: no silent exit on duplicate Signed-off-by lines
Browse files Browse the repository at this point in the history
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 <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Luben Tuikov authored and Junio C Hamano committed Aug 13, 2006
1 parent e77235e commit 9a1ae9a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion templates/hooks--commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
# This example catches duplicate Signed-off-by lines.

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

0 comments on commit 9a1ae9a

Please sign in to comment.