[1/3] dim: redo the author sob checks
diff mbox

Message ID 20170927094850.22484-1-daniel.vetter@ffwll.ch
State New
Headers show

Commit Message

Daniel Vetter Sept. 27, 2017, 9:48 a.m. UTC
This reverts commit 41dddc0287bb9ef14be8de3c3185ed6aaa809d98 and then
tries a different approach because from the commit that originally
introduced this:

commit 3dd25f235c73f7855dc570585eb2551961a1911a
Author: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Date:   Wed Jul 26 14:07:49 2017 +0200

    dim: add checks for author and committer sign-off-by

we have

    "Use real names for people with many different email addresses."

to work around outlook we need to convert the "Last, First" firm into
what git expects instead, which also should solve the problem Rodrigo
has.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 dim | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Rodrigo Vivi Sept. 27, 2017, 3:41 p.m. UTC | #1
On Wed, Sep 27, 2017 at 09:48:48AM +0000, Daniel Vetter wrote:
> This reverts commit 41dddc0287bb9ef14be8de3c3185ed6aaa809d98 and then
> tries a different approach because from the commit that originally
> introduced this:
> 
> commit 3dd25f235c73f7855dc570585eb2551961a1911a
> Author: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Date:   Wed Jul 26 14:07:49 2017 +0200
> 
>     dim: add checks for author and committer sign-off-by
> 
> we have
> 
>     "Use real names for people with many different email addresses."
> 
> to work around outlook we need to convert the "Last, First" firm into
> what git expects instead, which also should solve the problem Rodrigo
> has.
> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  dim | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/dim b/dim
> index 5e8c4d5b212d..4d75c7a7fb0e 100755
> --- a/dim
> +++ b/dim
> @@ -698,11 +698,13 @@ function checkpatch_commit_push
>  	sha1=$1
>  
>  	# use real names for people with many different email addresses
> -	author=$(git show -s $sha1 --format="format:%ae")
> +	author=$(git show -s $sha1 --format="format:%an")
>  	committer=$(git show -s $sha1 --format="format:%cn")
> +	# outlook mangles mails into "Last, First"
> +	author_outlook=$(git show -s $sha1 --format="format:%an" | sed -e 's/\([^ ]*\) \(.*\)/\2, \1/')
>  
>  	# check for author sign-off
> -	if ! git show -s $sha1 | grep -qi "S.*-by:.*$author"  ; then
> +	if ! git show -s $sha1 | grep -qi "S.*-by:.*\\($author\\|$author_outlook\\)" ; then
>  		warn_or_fail "$sha1 is lacking author of sign-off"
>  	fi
>  
> -- 
> 2.14.1
>

Patch
diff mbox

diff --git a/dim b/dim
index 5e8c4d5b212d..4d75c7a7fb0e 100755
--- a/dim
+++ b/dim
@@ -698,11 +698,13 @@  function checkpatch_commit_push
 	sha1=$1
 
 	# use real names for people with many different email addresses
-	author=$(git show -s $sha1 --format="format:%ae")
+	author=$(git show -s $sha1 --format="format:%an")
 	committer=$(git show -s $sha1 --format="format:%cn")
+	# outlook mangles mails into "Last, First"
+	author_outlook=$(git show -s $sha1 --format="format:%an" | sed -e 's/\([^ ]*\) \(.*\)/\2, \1/')
 
 	# check for author sign-off
-	if ! git show -s $sha1 | grep -qi "S.*-by:.*$author"  ; then
+	if ! git show -s $sha1 | grep -qi "S.*-by:.*\\($author\\|$author_outlook\\)" ; then
 		warn_or_fail "$sha1 is lacking author of sign-off"
 	fi