git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] hooks--commit-msg: no silent exit on duplicate Signed-off-by lines

From
LTLuben 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
Message 1 of 1 in “hooks--commit-msg: no silent exit on duplicate Signed-off-by lines”
  1. hooks--commit-msg: no silent exit on duplicate Signed-off-by linesLuben Tuikov, Aug 14, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.