[Intel-gfx] [maintainer-tools PATCH v2] dim: Check for required tags as part of dim_checkpatch

Imre Deak imre.deak at intel.com
Thu Mar 3 16:30:57 UTC 2016


Check in dim_checkpatch if the committer's Signed-off-by line and a
Reviewed-by line exists in the commit message. If no Reviewed-by line
exists also accept two distinct Signed-off-by lines instead.

v2: (Jani)
- move the check from dim_push_branch to dim_checkpatch
- remove the check for the author's Signed-off-by line
- in case there is no Reviewed-by line also accept two distinct
  Signed-off-by lines

CC: Jani Nikula <jani.nikula at intel.com>
Signed-off-by: Imre Deak <imre.deak at intel.com>
---
 dim | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/dim b/dim
index 1e7622a..2672fe0 100755
--- a/dim
+++ b/dim
@@ -706,6 +706,33 @@ function checkpatch_commit
 	shell_checkpatch "git show $commit --pretty=email"
 }
 
+function check_commit_tags
+{
+	local commit=$1
+
+	local commit_message=$(git show -s --format=%B $commit)
+	local committer_email=$(git show -s --format="%cn <%ce>" $commit)
+
+	local ret=0
+
+	local committer_sob="Signed-off-by: $committer_email"
+	if [ -z "$(echo "$commit_message" | grep "^$committer_sob")" ]; then
+		echo "Committer's tag missing: '$committer_sob'"
+
+		ret=1
+	fi
+
+	if [ -z "$(echo "$commit_message" | grep "^Reviewed-by:")" ] &&
+	   [ -z "$(echo "$commit_message" | grep "^Signed-off-by:" | \
+		  grep -v "^$committer_sob")" ]; then
+		echo "Reviewer's tag missing: one 'Reviewed-by' or two distinct 'Signed-off-by's"
+
+		ret=1
+	fi
+
+	return $ret
+}
+
 dim_alias_check_patch=checkpatch
 dim_alias_cp=checkpatch
 function dim_checkpatch
@@ -722,6 +749,7 @@ function dim_checkpatch
 
 	for commit in $(git rev-list --reverse $range); do
 		checkpatch_commit $commit || true
+		check_commit_tags $commit || true
 	done
 }
 
-- 
2.5.0



More information about the Intel-gfx mailing list