Thread (8 messages) 8 messages, 3 authors, 2017-08-14

Re: [PATCH 3/4] hook: add signature using "interpret-trailers"

flat view

From: Junio C Hamano <hidden>
Date: 2017-07-10 19:53:13

Possibly related (same subject, not in this thread)

Ramsay Jones [off-list ref] writes:
quoted
It works well in all cases except when the user invokes
"git commit" without any arguments. In that case manually
add a new line after the first line to ensure it's consistent
with the output of "-s" option.
Again, s/signature/sign-off/g, or similar (including subject line).
Thanks for being a careful reader.
quoted
Signed-off-by: Kaartic Sivaraam <redacted>
---
 templates/hooks--prepare-commit-msg.sample | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks--prepare-commit-msg.sample
index 708f0e92c..a15d6d634 100755
--- a/templates/hooks--prepare-commit-msg.sample
+++ b/templates/hooks--prepare-commit-msg.sample
@@ -32,4 +32,8 @@ SHA1=$3
 # esac
 
 # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
-# grep -qs "^$SOB" "$COMMIT_MSG_FILE" || echo "$SOB" >> "$COMMIT_MSG_FILE"
+# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
+# if test -z "$COMMIT_SOURCE"
+# then
+#   @PERL_PATH@ -i.bak -pe 'print "\n" if($first_line++ == 0)' "$COMMIT_MSG_FILE"
+# fi
I think we should do

	print "\n" if !$first_line++

for brevity (and also avoid "if(" that lacks SP) here.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help