From: Stephen Haberman Date: Fri, 20 Jun 2008 04:51:44 +0000 (-0500) Subject: Don't enforce log messages for merge commitss. X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1ba9db8d96452a0fabdab099586b025cf5299d98;p=git-central.git Don't enforce log messages for merge commitss. --- diff --git a/server/pre-receive-ticket b/server/pre-receive-ticket index 1553afe..2e57e58 100644 --- a/server/pre-receive-ticket +++ b/server/pre-receive-ticket @@ -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 index 0000000..b1b7ac3 --- /dev/null +++ b/tests/t2003-server-pre-receive-ticket-merges.sh @@ -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 +