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 <ltuikov@yahoo.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Luben Tuikov committed
Aug 13, 2006 at 01:41 UTC
9a1ae9ab03abaffc977421f182997f3e735e7098
1 file changed
+5
-1
templates/hooks--commit-msg
+5
-1
@@ -11,4 +11,8 @@
11
# This example catches duplicate Signed-off-by lines.
12
13
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
+