Subject: [PATCH] hooks/pre-commit: add example to add Signed-off-by line to message

From: Andy Parkins <[email-masked]>
Date: Wed, 20 Dec 2006 16:04:12 +0000

Based on Johannes Schindelin's earlier patch to perform the same
function.

The call to git-sh-setup was causing "Not a git repository" errors after
the pre-commit script had run.  I removed the call and used
$(git-rev-parse --git-dir) instead, which seems to have fixed the
problem.

Signed-off-by: Andy Parkins <[email-masked]>
---
 templates/hooks--pre-commit |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit
index 723a9ef..87d9ccc 100644
--- a/templates/hooks--pre-commit
+++ b/templates/hooks--pre-commit
@@ -7,6 +7,11 @@
 #
 # To enable this hook, make this file executable.
 
+# Uncomment the below to add a Signed-off-by line to the message.
+#git var GIT_AUTHOR_IDENT | \
+#sed -n "s/^\(.*\) [0-9]\+ [-+][0-9]\+$/Signed-off-by: \1/p" \
+# >> $(git-rev-parse --git-dir)/SQUASH_MSG
+
 # This is slightly modified from Andrew Morton's Perfect Patch.
 # Lines you introduce should not have trailing whitespace.
 # Also check for an indentation that has SP before a TAB.
-- 
1.4.4.2.g120e3