]> git.droids-corp.org - git-central.git/commitdiff
Don't enforce log messages for merge commitss.
authorStephen Haberman <stephen@exigencecorp.com>
Fri, 20 Jun 2008 04:51:44 +0000 (23:51 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Fri, 20 Jun 2008 04:51:44 +0000 (23:51 -0500)
server/pre-receive-ticket
tests/t2003-server-pre-receive-ticket-merges.sh [new file with mode: 0644]

index 1553afe4827fb5e080ee99b1155032305d213aec..2e57e5841efecbb3772fd305e20b9e27776ad238 100644 (file)
@@ -3,9 +3,9 @@
 while read oldrev newrev refname ; do
        if expr "$oldrev" : '0*$' >/dev/null
        then
-               git rev-parse --not --branches | grep -v $newrev | git rev-list --stdin $newrev
+               git rev-parse --not --branches | grep -v $newrev | git rev-list --stdin --no-merges $newrev
        else
-               git rev-parse --not --branches | grep -v $(git rev-parse $refname) | git rev-list --stdin $oldrev..$newrev
+               git rev-parse --not --branches | grep -v $(git rev-parse $refname) | git rev-list --stdin --no-merges $oldrev..$newrev
        fi | while read commit ; do
                git log -n 1 '--pretty=format:%s%n%b' "$commit" | grep -i '\(\(re\|refs\|qa\) #[0-9]\+\)\|\(no ticket\)' > /dev/null
                if [ $? -ne 0 ]
diff --git a/tests/t2003-server-pre-receive-ticket-merges.sh b/tests/t2003-server-pre-receive-ticket-merges.sh
new file mode 100644 (file)
index 0000000..b1b7ac3
--- /dev/null
@@ -0,0 +1,43 @@
+
+#!/bin/sh
+
+test_description='server pre-receive ticket enforcer via shim'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+       echo "setup" >a &&
+       git add a &&
+       git commit -m "setup" &&
+       git clone ./. server &&
+       rm -fr server/.git/hooks &&
+       git remote add origin ./server &&
+       git config --add branch.master.remote origin &&
+       git config --add branch.master.merge refs/heads/master
+'
+
+# setup the hook
+install_server_hook 'pre-receive-ticket' 'pre-receive'
+
+test_expect_success 'accept merge with merge message' '
+       git checkout -b topic1 master &&
+       echo "$test_name" >a1 &&
+       git add a1 &&
+       git commit -m "$test_name topic1 re #1" &&
+       git push origin topic1 &&
+
+       git checkout -b topic2 master &&
+       echo "$test_name" >a2 &&
+       git add a2 &&
+       git commit -m "$test_name topic2 re #2" &&
+       git push origin topic2 &&
+
+       git checkout topic1 &&
+       echo "$test_name" >>a1 &&
+       git commit -a -m "$test_name topic1 re #1 again" &&
+       git merge topic2 &&
+       git push
+'
+
+test_done
+