[PATCH] hooks--commit-msg: no silent exit on duplicate Signed-off-by lines
- From
- Luben Tuikov <ltuikov@yahoo.com>
- Date
- Aug 14, 2006, 02:43 UTC
- Message-ID
- <20060814024358.20988.qmail@web31803.mail.mud.yahoo.com>
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@yahoo.com> --- 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