aboutsummaryrefslogtreecommitdiff
path: root/templates/hooks--commit-msg
diff options
context:
space:
mode:
authorLuben Tuikov <ltuikov@yahoo.com>2006-08-13 01:41:22 -0700
committerJunio C Hamano <junkio@cox.net>2006-08-13 01:46:28 -0700
commit9a1ae9ab03abaffc977421f182997f3e735e7098 (patch)
tree4baa45e6def6d83fb86a5df65006d9453e8154c1 /templates/hooks--commit-msg
parente77235ea38385a127d2afc969435a56d3ff2b16d (diff)
downloadgit-9a1ae9ab03abaffc977421f182997f3e735e7098.tar.gz
git-9a1ae9ab03abaffc977421f182997f3e735e7098.tar.xz
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>
Diffstat (limited to 'templates/hooks--commit-msg')
-rw-r--r--templates/hooks--commit-msg6
1 files changed, 5 insertions, 1 deletions
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
+}
+