oldrev="$2"
newrev="$3"
+# We only care about branches moving--ignore tags/etc.
+case "$refname" in
+ refs/heads/*)
+ short_refname=${refname##refs/heads/}
+ ;;
+ *)
+ exit 0
+ ;;
+esac
+
+
+excused=" $(git config hooks.update-ensure-ticket-reference.excused) "
+if [[ $excused =~ " $short_refname " ]] ; then
+ exit 0
+fi
+
if expr "$oldrev" : '0*$' >/dev/null ; then
git rev-parse --not --branches | git rev-list --stdin --no-merges $newrev
else
'
# setup the hook
-install_server_hook 'update-ensure-ticket-reference' 'update'
+install_update_hook 'update-ensure-ticket-reference'
test_expect_success 'reject new branch with bad message' '
git checkout -b topic1 master &&
git push origin topic4
'
+test_expect_success 'accept branch that has been excused' '
+ git checkout -b topic5 master &&
+ echo "$test_name first" >a &&
+ git commit -a -m "$test_name first with no re" &&
+
+ ! git push origin topic5
+
+ cd server
+ git config hooks.update-ensure-ticket-reference.excused topic5
+ cd ..
+
+ git push origin topic5
+'
+
test_done