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

Benjamin Gaignard benjamin.gaignard at linaro.org
Wed Jul 26 10:27:11 UTC 2017


Rework checkpatch_commit_push logic to check for author and
committer sign-off-by.
Also add a check for "Link" tag added by dim apply-branch.

Remove the committer != author check because obviously some
authors commit their patches themselves. This test was
never done anyway because the first check of the function
directly return if true.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard at linaro.org>
---
 dim | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/dim b/dim
index 786fe6b..103334c 100755
--- a/dim
+++ b/dim
@@ -661,18 +661,28 @@ function checkpatch_commit_push
 	local sha1
 
 	sha1=$1
+	author=$(git show -s $sha1 --format="format:%ae")
+	committer=$(git show -s $sha1 --format="format:%ce")
 
 	# check for a-b/r-b tag
-	if git show -s $sha1 | grep -qi '\(reviewed\|acked\)\S*-by:'  ; then
-		return
+	if ! git show -s $sha1 | grep -qi '\(reviewed\|acked\)\S*-by:'  ; then
+		warn_or_fail "$sha1 is lacking mandatory review"
 	fi
 
-	# check for committer != author
-	if [[ $(git show -s $sha1 --format="format:%ce") != $(git show -s $sha1 --format="format:%ae") ]]; then
-		return
+	# 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
 
-	warn_or_fail "$sha1 is lacking mandatory review"
+	# 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
 }
 
 # push branch $1, rebuild drm-tip. the rest of the arguments are passed to git
-- 
1.9.1



More information about the dri-devel mailing list