Hi Gavin and Patrice,
Gavin Smith <[email protected]> writes:
> On Tue, May 20, 2025 at 10:06:17AM +0200, Patrice Dumas wrote:
>> Hello,
>>
>> The analysis and patch look good to me. Gavin, I think that you can
>> apply it (I know that it is a kind of patch practical for git to get
>> both the patch and commiter right, but I don't know how to apply that
>> kind of patch).
>
> I have applied the patch.
Thank you for checking and applying. Sorry for the missing ChangeLog
entry. I assumed they were generated from git. I am used to only writing
them for Gnulib.
> I use the git post-commit hook described in the README-hacking file
> to change the author field of the commit.
>
> ------------------------------------
> #!/bin/sh
>
> # post-commit
>
> # avoid recursion
> test $IN_GIT_HOOK_POST_COMMIT && exit 0
> export IN_GIT_HOOK_POST_COMMIT=1
>
> # Get author from latest ChangeLog entry. Remove date, leading and trailing
> # spaces, and condense multiple spaces to 1.
> CL_author=$(head -n 1 ChangeLog | sed -e 's/^[[:digit:]-]*//' -e 's/^ *//' -e
> 's/ *$//' -e 's/ \+/ /')
>
> # Get author from last commit
> HEAD_author=$(git log -1 --pretty=format:'%an <%ae>')
>
> if test "$CL_author" != "$HEAD_author" ; then
> git commit --amend --author="$CL_author" --reuse-message=HEAD
>
> echo "post-commit: changed author from '$HEAD_author'"
> echo "post-commit: to '$CL_author'."
> echo "post-commit: to override, run:"
> echo "post-commit: IN_GIT_HOOK_POST_COMMIT=1 git commit --amend -C HEAD
> --author=\"$HEAD_author\""
> fi
> ------------------------------------
Is there any benefit to doing this over just doing:
$ git am 0001-example-commit.patch
That command should set the author correctly.
Collin