From 1ba9db8d96452a0fabdab099586b025cf5299d98 Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Thu, 19 Jun 2008 23:51:44 -0500 Subject: [PATCH] Don't enforce log messages for merge commitss. --- server/pre-receive-ticket | 4 +- .../t2003-server-pre-receive-ticket-merges.sh | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 tests/t2003-server-pre-receive-ticket-merges.sh 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 + -- 2.39.5