The commit-msg hook 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 the
commit-msg hook actually print out a message that duplicate
Signed-off-lines were found (and thus nothing were
committed).
Signed-off-by: Luben Tuikov <ltuikov@xxxxxxxxx>
---
templates/hooks--commit-msg | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/templates/hooks--commit-msg b/templates/hooks--commit-msg
index 23617f3..ec2b017 100644
--- a/templates/hooks--commit-msg
+++ b/templates/hooks--commit-msg
@@ -10,5 +10,8 @@ # To enable this hook, make this file ex
# This example catches duplicate Signed-off-by lines.
-test "" = "$(grep '^Signed-off-by: ' "$1" |
- sort | uniq -c | sed -e '/^[ ]*1[ ]/d')"
+if [ -n "$(grep '^Signed-off-by: ' "$1" |
+ sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" ] ; then
+ echo "Duplicate Signed-off-by lines in commit message"
+ exit 1
+fi
--
1.4.2.g73dbd