Just checks that merges aren't done without minimal thought.

Cc: Jani Nikula <jani.nik...@linux.intel.com>
Cc: Dave Airlie <airl...@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vet...@intel.com>
---
 dim | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/dim b/dim
index c3229fd72193..ddfb809fcc5c 100755
--- a/dim
+++ b/dim
@@ -785,6 +785,24 @@ function checkpatch_commit_push
        return $rv
 }
 
+function checkmerge_commit_push
+{
+       local sha1 managed_branch rv body_text
+
+       sha1=$1
+       managed_branch=${2}
+       rv=0
+
+       body_text="$(git show $sha1 -s --format="format:%b" | grep -v "^$" | 
grep -v "^\S*:")"
+
+       if [[ -z "$body_text" ]] ; then
+               echoerr "$sha1 is lacking merge commit justification"
+               rv=1
+       fi
+
+       return $rv
+}
+
 function checkpatch_commit_push_range
 {
        local rv managed_branch
@@ -797,6 +815,10 @@ function checkpatch_commit_push_range
                checkpatch_commit_push $sha1 $managed_branch || rv=1
        done
 
+       for sha1 in $(git rev-list "$@" --merges) ; do
+               checkmerge_commit_push $sha1 $managed_branch || rv=1
+       done
+
        if [ $rv == "1" ] ; then
                warn_or_fail "issues in commits detected"
        fi
-- 
2.17.0

_______________________________________________
dim-tools mailing list
dim-tools@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dim-tools

Reply via email to