coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] maint: ensure "Co-authored-by" in commit message has an emai


From: Pádraig Brady
Subject: Re: [PATCH] maint: ensure "Co-authored-by" in commit message has an email address
Date: Sun, 13 Jul 2014 15:43:15 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 07/13/2014 03:12 PM, Bernhard Voelker wrote:
> Otherwise, the script "gitlog-to-changelog" would issue a warning
> during 'make dist':
> 
>   ./build-aux/gitlog-to-changelog  --since=2008-02-08 > /dev/null
>   gitlog-to-changelog: warning: missing email address for Bernhard \
>   Voelker.
>   gitlog-to-changelog: warning: missing email address for Niels Möller
> 
> * scripts/git-hooks/commit-msg: Add a check if a "Co-authored-by:"
> line has an email address.
> ---
>  scripts/git-hooks/commit-msg | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/scripts/git-hooks/commit-msg b/scripts/git-hooks/commit-msg
> index 559a0ea..4bd038a 100755
> --- a/scripts/git-hooks/commit-msg
> +++ b/scripts/git-hooks/commit-msg
> @@ -133,6 +133,13 @@ sub check_msg($$)
>    $buf =~ /^ *Signed-off-by:/mi
>      and return q(do not use "Signed-off-by:");
>  
> +  if ($buf =~ /^Co-authored-by:/mi)
> +    {
> +      # Ensure gitlog-to-changelog finds the email address in 
> "Co-authored-by".
> +      $buf =~ /^Co-authored-by:.*<.*?@.*\..*>/mi
> +        or return q(use email address in "Co-authored-by:");
> +    }
> +
>    return '';
>  }

Generally we try to keep emails out of commit messages since
they're quite ephemeral, and not subject to .mailmap etc.
So I'm fine with committing this, but possibly better would
be to update gitlog-to-changelog to query git for the address?
Perhaps something like this would work (which also honors
the .mailmap):

  git_email() {
    GIT_PAGER= git log -1 --author="$1" --pretty='format:%aE'
  }
  echo $(git_email "Niels Möller")

thanks,
Pádraig.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]