summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorLibravatar Andy Parkins <andyparkins@gmail.com>2006-12-21 09:24:17 +0000
committerLibravatar Junio C Hamano <junkio@cox.net>2006-12-26 12:25:34 -0800
commit59f3e254801648322b2d5cd073ca0cc5009aa2de (patch)
tree58fe625e4c20b9601fffc715545741603dfc7d40 /templates
parentmove git-blame to its place in .gitignore (diff)
downloadtgif-59f3e254801648322b2d5cd073ca0cc5009aa2de.tar.xz
hooks/commit-msg: add example to add Signed-off-by line to message
After checking to see if the commit message already has the target signed-off-by (for example in --amend commits), this patch generates a signed off by line from the repository owner and adds it to the commit message. Based on Johannes Schindelin's earlier patch to perform the same function. Originally, this was done in the pre-commit hook but Junio pointed out that the commit-msg hook allows the message to be edited. This has the aditional advantage that the commit-msg hook gets passed the name of the message file as a parameter, so it doesn't have to figure out GIT_DIR for itself. Signed-off-by: Andy Parkins <andyparkins@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'templates')
-rw-r--r--templates/hooks--commit-msg4
1 files changed, 4 insertions, 0 deletions
diff --git a/templates/hooks--commit-msg b/templates/hooks--commit-msg
index 0b906caa98..9b04f2d69c 100644
--- a/templates/hooks--commit-msg
+++ b/templates/hooks--commit-msg
@@ -8,6 +8,10 @@
#
# To enable this hook, make this file executable.
+# Uncomment the below to add a Signed-off-by line to the message.
+# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
+# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
+
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |