From: Luben Tuikov Date: Sun, 13 Aug 2006 08:41:22 +0000 (-0700) Subject: sample commit-msg hook: no silent exit on duplicate Signed-off-by lines X-Git-Tag: v1.4.2.1~8 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9a1ae9ab03abaffc977421f182997f3e735e7098;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/templates/hooks--commit-msg b/templates/hooks--commit-msg index 23617f390..0b906caa9 100644 --- a/templates/hooks--commit-msg +++ b/templates/hooks--commit-msg @@ -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 +} +