[sysadmin-bin: 164/168] Reject commit messages auto-generated by git-bz



commit 8721ed5d79a8124ab814678a6a01b0ee125e99e3
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu Mar 1 15:12:44 2012 -0500

    Reject commit messages auto-generated by git-bz
    
    If we see a commit which includes the string:
    
     FIXME: needs commit message
    
    Reject the push, since that's what git-bz now uses when you
    'git bz apply' a raw patch from Bugzilla.

 pre-receive-check-policy |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/pre-receive-check-policy b/pre-receive-check-policy
index 19b2cc0..cc5b90c 100755
--- a/pre-receive-check-policy
+++ b/pre-receive-check-policy
@@ -67,6 +67,26 @@ check_commit() {
 	    exit 1
 	fi
     fi
+
+    body="$(git log $commit -1 --pretty=format:%b)"
+    if expr "$body" : ".*FIXME: need commit message" > /dev/null 2>&1; then
+	if ! in_import && ! forced ; then
+	    cat <<- EOF >&2
+				---
+				The commit:
+
+				EOF
+	    git log $commit -1 >&2
+	    cat <<- EOF >&2
+
+				Was created by git-bz from a plain diff. Please edit the commit message
+				to properly describe the commit using 'git commit --amend' or
+				(for an older commit) 'git rebase -i'. Then try 'git push' again.
+				EOF
+	    exit 1
+        fi
+    fi
+
 }
 
 check_ref_update() {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]