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

Message ID 1501070869-26411-1-git-send-email-benjamin.gaignard@linaro.org
State New
Headers show

Commit Message

Benjamin Gaignard July 26, 2017, 12:07 p.m.
Add checks for author and committer sign-off-by.
Add a check for "Link" tag added by dim apply-branch.

Use real names for people with many different email addresses.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
---
version 2:
- keep the same logic than before for reviewed/acked-by checks
- use real names

 dim | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

Comments

Daniel Vetter July 26, 2017, 12:11 p.m. | #1
On Wed, Jul 26, 2017 at 02:07:49PM +0200, Benjamin Gaignard wrote:
> Add checks for author and committer sign-off-by.
> Add a check for "Link" tag added by dim apply-branch.
> 
> Use real names for people with many different email addresses.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> ---
> version 2:
> - keep the same logic than before for reviewed/acked-by checks
> - use real names

Thanks for respinning, applied&pushed.
-Daniel

> 
>  dim | 21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/dim b/dim
> index 786fe6b..c0cbe35 100755
> --- a/dim
> +++ b/dim
> @@ -662,13 +662,32 @@ function checkpatch_commit_push
>  
>  	sha1=$1
>  
> +	# use real names for people with many different email addresses
> +	author=$(git show -s $sha1 --format="format:%an")
> +	committer=$(git show -s $sha1 --format="format:%cn")
> +
> +	# check for author sign-off
> +	if ! git show -s $sha1 | grep -qi "S.*-by:.*$author"  ; then
> +		warn_or_fail "$sha1 is lacking author of sign-off"
> +	fi
> +
> +	# check for committer sign-off
> +	if ! git show -s $sha1 | grep -qi "S.*-by:.*$committer"  ; then
> +		warn_or_fail "$sha1 is lacking committer of sign-off"
> +	fi
> +
> +	# check for Link tag
> +	if ! git show -s $sha1 | grep -qi 'Link:'  ; then
> +		warn_or_fail "$sha1 is lacking of link tag"
> +	fi
> +
>  	# check for a-b/r-b tag
>  	if git show -s $sha1 | grep -qi '\(reviewed\|acked\)\S*-by:'  ; then
>  		return
>  	fi
>  
>  	# check for committer != author
> -	if [[ $(git show -s $sha1 --format="format:%ce") != $(git show -s $sha1 --format="format:%ae") ]]; then
> +	if [[ $committer  != $author ]]; then
>  		return
>  	fi
>  
> -- 
> 1.9.1
>

Patch

diff --git a/dim b/dim
index 786fe6b..c0cbe35 100755
--- a/dim
+++ b/dim
@@ -662,13 +662,32 @@  function checkpatch_commit_push
 
 	sha1=$1
 
+	# use real names for people with many different email addresses
+	author=$(git show -s $sha1 --format="format:%an")
+	committer=$(git show -s $sha1 --format="format:%cn")
+
+	# check for author sign-off
+	if ! git show -s $sha1 | grep -qi "S.*-by:.*$author"  ; then
+		warn_or_fail "$sha1 is lacking author of sign-off"
+	fi
+
+	# check for committer sign-off
+	if ! git show -s $sha1 | grep -qi "S.*-by:.*$committer"  ; then
+		warn_or_fail "$sha1 is lacking committer of sign-off"
+	fi
+
+	# check for Link tag
+	if ! git show -s $sha1 | grep -qi 'Link:'  ; then
+		warn_or_fail "$sha1 is lacking of link tag"
+	fi
+
 	# check for a-b/r-b tag
 	if git show -s $sha1 | grep -qi '\(reviewed\|acked\)\S*-by:'  ; then
 		return
 	fi
 
 	# check for committer != author
-	if [[ $(git show -s $sha1 --format="format:%ce") != $(git show -s $sha1 --format="format:%ae") ]]; then
+	if [[ $committer  != $author ]]; then
 		return
 	fi