public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [maintainer-tools PATCH] dim: Check for required tags before pushing a branch
@ 2016-03-02 15:23 Imre Deak
  2016-03-03  8:11 ` Jani Nikula
  2016-03-03 16:30 ` [maintainer-tools PATCH v2] dim: Check for required tags as part of dim_checkpatch Imre Deak
  0 siblings, 2 replies; 5+ messages in thread
From: Imre Deak @ 2016-03-02 15:23 UTC (permalink / raw)
  To: intel-gfx; +Cc: Jani Nikula

Check if the committer's and author's Signed-off-by line and at least
one Reviewed-by line exists in each commit to be pushed.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 dim | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/dim b/dim
index 1addd6f..b951fb4 100755
--- a/dim
+++ b/dim
@@ -361,6 +361,37 @@ function dim_nightly_forget
 	git rerere forget
 }
 
+function assert_one_commit_tag
+{
+        local commit_message="$1"
+        local tag="$2"
+
+        if ! echo "$commit_message" | grep -q "^$tag"; then
+                echo "Tag '$tag' missing from $commit"
+                return 1
+        fi
+
+}
+
+function assert_all_commit_tags
+{
+        local branch=$1
+        local new_commits=$(git rev-list $DIM_DRM_INTEL_REMOTE/$branch..$branch)
+
+        local commit
+        for commit in $new_commits; do
+                local commit_message=$(git show -s --format=%B $commit)
+                local committer_email=$(git show -s --format="%cn <%ce>" $commit)
+                local author_email=$(git show -s --format="%an <%ae>" $commit)
+
+                assert_one_commit_tag "$commit_message" "Signed-off-by: $author_email"
+                assert_one_commit_tag "$commit_message" "Signed-off-by: $committer_email"
+                assert_one_commit_tag "$commit_message" "Reviewed-by: .\+ <.\+@.\+>"
+        done
+
+        return 0
+}
+
 # push branch $1, rebuild nightly. the rest of the arguments are passed to git
 # push.
 function dim_push_branch
@@ -374,6 +405,7 @@ function dim_push_branch
 	shift
 
 	assert_branch $branch
+	assert_all_commit_tags $branch
 
 	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $branch "$@"
 
-- 
2.5.0

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-03 16:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [maintainer-tools PATCH v2] dim: Check for required tags as part of dim_checkpatch Imre Deak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox