]> git.droids-corp.org - git-central.git/commitdiff
-ticket > -trac.
authorStephen Haberman <stephen@exigencecorp.com>
Fri, 20 Jun 2008 14:55:45 +0000 (09:55 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Fri, 20 Jun 2008 14:55:45 +0000 (09:55 -0500)
21 files changed:
cbas/post-receive [new file with mode: 0644]
cbas/pre-receive [new file with mode: 0644]
client/commit-msg [deleted file]
client/commit-msg-trac [new file with mode: 0644]
server/post-receive [deleted file]
server/pre-receive [deleted file]
server/pre-receive-ticket [deleted file]
server/pre-receive-trac [new file with mode: 0644]
server/pre-receive-trac-then-noop [new file with mode: 0644]
tests/t1000-client-commit-msg-ticket-hook.sh [deleted file]
tests/t1000-client-commit-msg-trac.sh [new file with mode: 0644]
tests/t1001-client-commit-msg-ticket-merge.sh [deleted file]
tests/t1001-client-commit-msg-trac-merges.sh [new file with mode: 0644]
tests/t2000-server-pre-receive-ticket.sh [deleted file]
tests/t2000-server-pre-receive-trac.sh [new file with mode: 0644]
tests/t2001-server-pre-receive-ticket-via-shim.sh [deleted file]
tests/t2001-server-pre-receive-trac-via-shim.sh [new file with mode: 0644]
tests/t2002-server-pre-receive-ticket-branches.sh [deleted file]
tests/t2002-server-pre-receive-trac-branches.sh [new file with mode: 0644]
tests/t2003-server-pre-receive-ticket-merges.sh [deleted file]
tests/t2003-server-pre-receive-trac-merges.sh [new file with mode: 0644]

diff --git a/cbas/post-receive b/cbas/post-receive
new file mode 100644 (file)
index 0000000..f345eed
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# Delegates to post-receive-email and post-receive-trac
+#
+
+input=""
+while read line ; do
+    input="$input$line"
+done
+
+echo $input | sh $GIT_DIR/hooks/post-receive-email
+echo $input | sh $GIT_DIR/hooks/post-receive-trac
+
diff --git a/cbas/pre-receive b/cbas/pre-receive
new file mode 100644 (file)
index 0000000..5ed7e5c
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+input=""
+while read line ; do
+    input="$input$line"
+done
+
+echo $input | sh $GIT_DIR/hooks/pre-receive-stable &&
+echo $input | sh $GIT_DIR/hooks/noop
+
diff --git a/client/commit-msg b/client/commit-msg
deleted file mode 100644 (file)
index 0800f02..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-grep -i '\(\(re\|refs\|qa\) #[0-9]\+\)\|\(no ticket\)' "$1" > /dev/null
-
-if [ $? -ne 0 ]
-then
-       echo "Please reference a ticket"
-       exit 1
-fi
-
diff --git a/client/commit-msg-trac b/client/commit-msg-trac
new file mode 100644 (file)
index 0000000..0800f02
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+grep -i '\(\(re\|refs\|qa\) #[0-9]\+\)\|\(no ticket\)' "$1" > /dev/null
+
+if [ $? -ne 0 ]
+then
+       echo "Please reference a ticket"
+       exit 1
+fi
+
diff --git a/server/post-receive b/server/post-receive
deleted file mode 100644 (file)
index f345eed..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-#
-# Delegates to post-receive-email and post-receive-trac
-#
-
-input=""
-while read line ; do
-    input="$input$line"
-done
-
-echo $input | sh $GIT_DIR/hooks/post-receive-email
-echo $input | sh $GIT_DIR/hooks/post-receive-trac
-
diff --git a/server/pre-receive b/server/pre-receive
deleted file mode 100644 (file)
index 5ed7e5c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-input=""
-while read line ; do
-    input="$input$line"
-done
-
-echo $input | sh $GIT_DIR/hooks/pre-receive-stable &&
-echo $input | sh $GIT_DIR/hooks/noop
-
diff --git a/server/pre-receive-ticket b/server/pre-receive-ticket
deleted file mode 100644 (file)
index 2e57e58..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-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 --no-merges $newrev
-       else
-               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 ]
-               then
-                       echo "Commit $commit does not reference a ticket"
-                       exit 1
-               fi
-       done
-done
-
diff --git a/server/pre-receive-trac b/server/pre-receive-trac
new file mode 100644 (file)
index 0000000..2e57e58
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+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 --no-merges $newrev
+       else
+               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 ]
+               then
+                       echo "Commit $commit does not reference a ticket"
+                       exit 1
+               fi
+       done
+done
+
diff --git a/server/pre-receive-trac-then-noop b/server/pre-receive-trac-then-noop
new file mode 100644 (file)
index 0000000..ae2d7cf
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+input=""
+while read line ; do
+    input="$input$line"
+done
+
+echo $input | sh $GIT_DIR/hooks/pre-receive-trac &&
+echo $input | sh $GIT_DIR/hooks/noop
+
diff --git a/tests/t1000-client-commit-msg-ticket-hook.sh b/tests/t1000-client-commit-msg-ticket-hook.sh
deleted file mode 100644 (file)
index 0e4146e..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-
-test_description='client commit-msg ticket enforcer'
-
-. ./test-lib.sh
-
-# setup the commit-msg hook
-install_client_hook 'commit-msg' 'commit-msg'
-
-test_expect_success 'rejects with bad message' '
-       echo "$test_name" >file &&
-       git add file &&
-       ! git commit -m "first"
-'
-
-test_expect_success 'rejects with re:' '
-       echo "$test_name" >file &&
-       git add file &&
-       ! git commit -m "first re: #3200"
-'
-
-test_expect_success 'rejects with re no space' '
-       echo "$test_name" >file &&
-       git add file &&
-       ! git commit -m "first re#3200"
-'
-
-test_expect_success 'accepts with re' '
-       echo "$test_name" >file &&
-       git add file &&
-       git commit -m "first re #3200"
-'
-
-test_expect_success 'accepts with re on the second line' '
-       echo "$test_name" >file &&
-       git add file &&
-       echo "line one" >msg &&
-       echo "line two re #3200" >>msg &&
-       git commit -F msg
-'
-
-test_expect_success 'accepts with RE' '
-       echo "$test_name" >file &&
-       git add file &&
-       git commit -m "first RE #3200"
-'
-
-test_expect_success 'accepts with refs' '
-       echo "$test_name" >file &&
-       git add file &&
-       git commit -m "first refs #3200"
-'
-
-test_expect_success 'accepts with qa' '
-       echo "$test_name" >file &&
-       git add file &&
-       git commit -m "first qa #3200"
-'
-
-test_expect_success 'accepts with no ticket' '
-       echo "$test_name" >file &&
-       git add file &&
-       git commit -m "first no ticket"
-'
-
-test_done
-
diff --git a/tests/t1000-client-commit-msg-trac.sh b/tests/t1000-client-commit-msg-trac.sh
new file mode 100644 (file)
index 0000000..5e70a4c
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+test_description='client commit-msg trac ticket enforcer'
+
+. ./test-lib.sh
+
+# setup the commit-msg hook
+install_client_hook 'commit-msg-trac' 'commit-msg'
+
+test_expect_success 'rejects with bad message' '
+       echo "$test_name" >file &&
+       git add file &&
+       ! git commit -m "first"
+'
+
+test_expect_success 'rejects with re:' '
+       echo "$test_name" >file &&
+       git add file &&
+       ! git commit -m "first re: #3200"
+'
+
+test_expect_success 'rejects with re no space' '
+       echo "$test_name" >file &&
+       git add file &&
+       ! git commit -m "first re#3200"
+'
+
+test_expect_success 'accepts with re' '
+       echo "$test_name" >file &&
+       git add file &&
+       git commit -m "first re #3200"
+'
+
+test_expect_success 'accepts with re on the second line' '
+       echo "$test_name" >file &&
+       git add file &&
+       echo "line one" >msg &&
+       echo "line two re #3200" >>msg &&
+       git commit -F msg
+'
+
+test_expect_success 'accepts with RE' '
+       echo "$test_name" >file &&
+       git add file &&
+       git commit -m "first RE #3200"
+'
+
+test_expect_success 'accepts with refs' '
+       echo "$test_name" >file &&
+       git add file &&
+       git commit -m "first refs #3200"
+'
+
+test_expect_success 'accepts with qa' '
+       echo "$test_name" >file &&
+       git add file &&
+       git commit -m "first qa #3200"
+'
+
+test_expect_success 'accepts with no ticket' '
+       echo "$test_name" >file &&
+       git add file &&
+       git commit -m "first no ticket"
+'
+
+test_done
+
diff --git a/tests/t1001-client-commit-msg-ticket-merge.sh b/tests/t1001-client-commit-msg-ticket-merge.sh
deleted file mode 100644 (file)
index 79cd9f7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-test_description='client commit-msg ticket enforcer for merges'
-
-. ./test-lib.sh
-
-# setup the commit-msg hook
-install_client_hook 'commit-msg' 'commit-msg'
-
-test_expect_success 'accepts merge' '
-       echo "$test_name" >file &&
-       git add file &&
-       git commit -m "line one. re #3222." &&
-       git checkout -b topic1 &&
-       echo "$test_name topic1" >>file &&
-       git commit -a -m "line two. re #3222." &&
-       git checkout master &&
-       echo "$test_name" > file2 &&
-       git add file2 &&
-       git commit -m "file2. re #3222." &&
-       git merge topic1 &&
-       git log -n 1 HEAD | grep "Merge branch"
-'
-
-test_done
-
diff --git a/tests/t1001-client-commit-msg-trac-merges.sh b/tests/t1001-client-commit-msg-trac-merges.sh
new file mode 100644 (file)
index 0000000..80206b5
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+test_description='client commit-msg trac ticket enforcer for merges'
+
+. ./test-lib.sh
+
+# setup the commit-msg hook
+install_client_hook 'commit-msg-trac' 'commit-msg'
+
+test_expect_success 'accepts merge' '
+       echo "$test_name" >file &&
+       git add file &&
+       git commit -m "line one. re #3222." &&
+       git checkout -b topic1 &&
+       echo "$test_name topic1" >>file &&
+       git commit -a -m "line two. re #3222." &&
+       git checkout master &&
+       echo "$test_name" > file2 &&
+       git add file2 &&
+       git commit -m "file2. re #3222." &&
+       git merge topic1 &&
+       git log -n 1 HEAD | grep "Merge branch"
+'
+
+test_done
+
diff --git a/tests/t2000-server-pre-receive-ticket.sh b/tests/t2000-server-pre-receive-ticket.sh
deleted file mode 100644 (file)
index 27b1b11..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/sh
-
-test_description='server pre-receive ticket enforcer'
-
-. ./test-lib.sh
-
-test_expect_success 'setup' '
-       echo This is a test. >a &&
-       git add a &&
-       git commit -m "a" &&
-       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 pre-receive hook
-install_server_hook 'pre-receive-ticket' 'pre-receive'
-
-test_expect_success 'reject with bad message' '
-       echo $test_name >a &&
-       git commit -a -m "$test_name" &&
-       head=$(git rev-parse HEAD) &&
-       ! git push >push.out 2>push.err &&
-       cat push.err | grep "Commit $head does not reference a ticket"
-'
-
-# the last test has a dirty commit message, so ammend it with a good message
-test_expect_success 'accept with re' '
-       echo $test_name >a &&
-       git commit --amend -m "$test_name re #3222" &&
-       git push
-'
-
-test_expect_success 'accept with re on second line' '
-       echo $test_name >a &&
-       echo "first subject line" >msg
-       echo "second line re #322" >>msg
-       git commit -a -F msg &&
-       git push
-'
-
-test_expect_success 'reject with bad message in second of three' '
-       echo "$test_name first" >a &&
-       git commit -a -m "$test_name first re #3222" &&
-
-       # the bad one
-       echo "$test_name second" >a &&
-       git commit -a -m "$test_name second" &&
-       head=$(git rev-parse HEAD) &&
-       echo "head=$head" &&
-
-       echo "$test_name third" >a &&
-       git commit -a -m "$test_name third re #3222" &&
-
-       ! git push >push.out 2>push.err &&
-       cat push.err | grep "Commit $head does not reference a ticket"
-'
-
-test_expect_success 'accept with re in all of three' '
-       git reset --hard HEAD^^^ &&
-       echo "$test_name first" >a &&
-       git commit -a -m "$test_name first re #3222" &&
-
-       # the bad one
-       echo "$test_name second" >a &&
-       git commit -a -m "$test_name second re #3222" &&
-       head=$(git rev-parse HEAD) &&
-
-       echo "$test_name third" >a &&
-       git commit -a -m "$test_name third re #3222" &&
-
-       git push
-'
-
-test_done
-
diff --git a/tests/t2000-server-pre-receive-trac.sh b/tests/t2000-server-pre-receive-trac.sh
new file mode 100644 (file)
index 0000000..38d3946
--- /dev/null
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+test_description='server pre-receive trac ticket enforcer'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+       echo This is a test. >a &&
+       git add a &&
+       git commit -m "a" &&
+       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 pre-receive hook
+install_server_hook 'pre-receive-trac' 'pre-receive'
+
+test_expect_success 'reject with bad message' '
+       echo $test_name >a &&
+       git commit -a -m "$test_name" &&
+       head=$(git rev-parse HEAD) &&
+       ! git push >push.out 2>push.err &&
+       cat push.err | grep "Commit $head does not reference a ticket"
+'
+
+# the last test has a dirty commit message, so ammend it with a good message
+test_expect_success 'accept with re' '
+       echo $test_name >a &&
+       git commit --amend -m "$test_name re #3222" &&
+       git push
+'
+
+test_expect_success 'accept with re on second line' '
+       echo $test_name >a &&
+       echo "first subject line" >msg
+       echo "second line re #322" >>msg
+       git commit -a -F msg &&
+       git push
+'
+
+test_expect_success 'reject with bad message in second of three' '
+       echo "$test_name first" >a &&
+       git commit -a -m "$test_name first re #3222" &&
+
+       # the bad one
+       echo "$test_name second" >a &&
+       git commit -a -m "$test_name second" &&
+       head=$(git rev-parse HEAD) &&
+       echo "head=$head" &&
+
+       echo "$test_name third" >a &&
+       git commit -a -m "$test_name third re #3222" &&
+
+       ! git push >push.out 2>push.err &&
+       cat push.err | grep "Commit $head does not reference a ticket"
+'
+
+test_expect_success 'accept with re in all of three' '
+       git reset --hard HEAD^^^ &&
+       echo "$test_name first" >a &&
+       git commit -a -m "$test_name first re #3222" &&
+
+       # the bad one
+       echo "$test_name second" >a &&
+       git commit -a -m "$test_name second re #3222" &&
+       head=$(git rev-parse HEAD) &&
+
+       echo "$test_name third" >a &&
+       git commit -a -m "$test_name third re #3222" &&
+
+       git push
+'
+
+test_done
+
diff --git a/tests/t2001-server-pre-receive-ticket-via-shim.sh b/tests/t2001-server-pre-receive-ticket-via-shim.sh
deleted file mode 100644 (file)
index 7167fd8..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-test_description='server pre-receive ticket enforcer via shim'
-
-. ./test-lib.sh
-
-test_expect_success 'setup' '
-       echo This is a test. >a &&
-       git add a &&
-       git commit -m "a" &&
-       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 shim
-install_server_hook 'pre-receive' 'pre-receive'
-install_server_hook 'pre-receive-ticket' 'pre-receive-ticket'
-
-test_expect_success 'reject with bad message via shim' '
-       echo $test_name >a &&
-       git commit -a -m "$test_name" &&
-       head=$(git rev-parse HEAD) &&
-       ! git push >push.out 2>push.err &&
-       cat push.err | grep "Commit $head does not reference a ticket"
-'
-
-# the last test has a dirty commit message, so ammend it with a good message
-test_expect_success 'accept with re via shim' '
-       echo $test_name >a &&
-       git commit --amend -m "$test_name re #3222" &&
-       git push
-'
-
-test_done
-
diff --git a/tests/t2001-server-pre-receive-trac-via-shim.sh b/tests/t2001-server-pre-receive-trac-via-shim.sh
new file mode 100644 (file)
index 0000000..646cf37
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+test_description='server pre-receive trac ticket enforcer via shim'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+       echo This is a test. >a &&
+       git add a &&
+       git commit -m "a" &&
+       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 shim
+install_server_hook 'noop' 'noop'
+install_server_hook 'pre-receive-trac' 'pre-receive-trac'
+install_server_hook 'pre-receive-trac-then-noop' 'pre-receive'
+
+test_expect_success 'reject with bad message via shim' '
+       echo $test_name >a &&
+       git commit -a -m "$test_name" &&
+       head=$(git rev-parse HEAD) &&
+       ! git push >push.out 2>push.err &&
+       cat push.err | grep "Commit $head does not reference a ticket"
+'
+
+# the last test has a dirty commit message, so ammend it with a good message
+test_expect_success 'accept with re via shim' '
+       echo $test_name >a &&
+       git commit --amend -m "$test_name re #3222" &&
+       git push
+'
+
+test_done
+
diff --git a/tests/t2002-server-pre-receive-ticket-branches.sh b/tests/t2002-server-pre-receive-ticket-branches.sh
deleted file mode 100644 (file)
index b9c95ba..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/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 'reject new branch with bad message' '
-       git checkout -b topic1 master &&
-       echo $test_name >a &&
-       git commit -a -m "$test_name" &&
-       head=$(git rev-parse HEAD)
-       ! git push origin topic1 >push.out 2>push.err &&
-       cat push.err | grep "Commit $head does not reference a ticket"
-'
-
-# the last test has a dirty commit message, so ammend it with a good message
-test_expect_success 'accept new branch with re' '
-       git checkout -b topic2 master &&
-       echo $test_name >a &&
-       git commit --amend -m "$test_name re #3222" &&
-       git push origin topic2
-'
-
-test_expect_success 'reject new branch with bad message in second of three' '
-       git checkout -b topic3 master &&
-       echo "$test_name first" >a &&
-       git commit -a -m "$test_name first re #3222" &&
-
-       # the bad one
-       echo "$test_name second" >a &&
-       git commit -a -m "$test_name second" &&
-       head=$(git rev-parse HEAD) &&
-
-       echo "$test_name third" >a &&
-       git commit -a -m "$test_name third re #3222" &&
-
-       ! git push origin topic3 >push.out 2>push.err &&
-       cat push.err | grep "Commit $head does not reference a ticket"
-'
-
-test_expect_success 'accept new branch with re in all of three' '
-       git checkout -b topic4 master &&
-       echo "$test_name first" >a &&
-       git commit -a -m "$test_name first re #3222" &&
-
-       # the bad one
-       echo "$test_name second" >a &&
-       git commit -a -m "$test_name second re #3222" &&
-       head=$(git rev-parse HEAD) &&
-
-       echo "$test_name third" >a &&
-       git commit -a -m "$test_name third re #3222" &&
-
-       git push origin topic4
-'
-
-test_done
-
diff --git a/tests/t2002-server-pre-receive-trac-branches.sh b/tests/t2002-server-pre-receive-trac-branches.sh
new file mode 100644 (file)
index 0000000..3588124
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+test_description='server pre-receive trac 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-trac' 'pre-receive'
+
+test_expect_success 'reject new branch with bad message' '
+       git checkout -b topic1 master &&
+       echo $test_name >a &&
+       git commit -a -m "$test_name" &&
+       head=$(git rev-parse HEAD)
+       ! git push origin topic1 >push.out 2>push.err &&
+       cat push.err | grep "Commit $head does not reference a ticket"
+'
+
+# the last test has a dirty commit message, so ammend it with a good message
+test_expect_success 'accept new branch with re' '
+       git checkout -b topic2 master &&
+       echo $test_name >a &&
+       git commit --amend -m "$test_name re #3222" &&
+       git push origin topic2
+'
+
+test_expect_success 'reject new branch with bad message in second of three' '
+       git checkout -b topic3 master &&
+       echo "$test_name first" >a &&
+       git commit -a -m "$test_name first re #3222" &&
+
+       # the bad one
+       echo "$test_name second" >a &&
+       git commit -a -m "$test_name second" &&
+       head=$(git rev-parse HEAD) &&
+
+       echo "$test_name third" >a &&
+       git commit -a -m "$test_name third re #3222" &&
+
+       ! git push origin topic3 >push.out 2>push.err &&
+       cat push.err | grep "Commit $head does not reference a ticket"
+'
+
+test_expect_success 'accept new branch with re in all of three' '
+       git checkout -b topic4 master &&
+       echo "$test_name first" >a &&
+       git commit -a -m "$test_name first re #3222" &&
+
+       # the bad one
+       echo "$test_name second" >a &&
+       git commit -a -m "$test_name second re #3222" &&
+       head=$(git rev-parse HEAD) &&
+
+       echo "$test_name third" >a &&
+       git commit -a -m "$test_name third re #3222" &&
+
+       git push origin topic4
+'
+
+test_done
+
diff --git a/tests/t2003-server-pre-receive-ticket-merges.sh b/tests/t2003-server-pre-receive-ticket-merges.sh
deleted file mode 100644 (file)
index 7ca02b1..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/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
-
diff --git a/tests/t2003-server-pre-receive-trac-merges.sh b/tests/t2003-server-pre-receive-trac-merges.sh
new file mode 100644 (file)
index 0000000..7d3180d
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+test_description='server pre-receive trac 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-trac' '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
+