--- /dev/null
+#!/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
+
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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
+
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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
+
+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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
+