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

2017-07-11 Thread Kaartic Sivaraam
Note: Re-attempting to send mail due to rejection
On Mon, 2017-07-10 at 16:13 +0100, Ramsay Jones wrote:
> 
> Again, s/signature/sign-off/g, or similar (including subject line).
> 
Thanks! Forgot that in the course of splitting the patches and
modifying them.

-- 
Kaartic


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

2017-07-11 Thread Kaartic Sivaraam
On Mon, 2017-07-10 at 16:13 +0100, Ramsay Jones wrote:
> 
> Again, s/signature/sign-off/g, or similar (including subject line).
> 
Thanks! Forgot that in the course of splitting the patches and
modifying them.


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

2017-07-10 Thread Junio C Hamano
Ramsay Jones  writes:

>> 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.

>> Signed-off-by: Kaartic Sivaraam 
>> ---
>>  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.



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

2017-07-10 Thread Ramsay Jones


On 10/07/17 15:17, Kaartic Sivaraam wrote:
> The sample hook to prepare the commit message before
> a commit allows users to opt-in to add the signature
> to the commit message. The signature is added at a place
> that isn't consistent with the "-s" option of "git commit".
> Further, it could go out of view in certain cases.
> 
> Add the signature in a way similar to "-s" option of
> "git commit" using git's interpret-trailers command.
> 
> 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).

ATB,
Ramsay Jones


> Signed-off-by: Kaartic Sivaraam 
> ---
>  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
> 


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

2017-07-10 Thread Kaartic Sivaraam
The sample hook to prepare the commit message before
a commit allows users to opt-in to add the signature
to the commit message. The signature is added at a place
that isn't consistent with the "-s" option of "git commit".
Further, it could go out of view in certain cases.

Add the signature in a way similar to "-s" option of
"git commit" using git's interpret-trailers command.

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.

Signed-off-by: Kaartic Sivaraam 
---
 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
-- 
2.13.2.957.g457671ade