public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: [maintainer-tools PATCH v2] dim: Check for required tags as part of dim_checkpatch
Date: Thu,  3 Mar 2016 18:30:57 +0200	[thread overview]
Message-ID: <1457022657-19318-1-git-send-email-imre.deak@intel.com> (raw)
In-Reply-To: <1456932222-26116-1-git-send-email-imre.deak@intel.com>

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@intel.com>
Signed-off-by: Imre Deak <imre.deak@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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2016-03-03 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02 15:23 [maintainer-tools PATCH] dim: Check for required tags before pushing a branch Imre Deak
2016-03-03  8:11 ` Jani Nikula
2016-03-03 10:13   ` Imre Deak
2016-03-03 12:18     ` Jani Nikula
2016-03-03 16:30 ` Imre Deak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457022657-19318-1-git-send-email-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox