+++ /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 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 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_expect_success 'accepts hand-editted merge' '
- git checkout topic1 &&
- echo "$test_name" >>file &&
- git commit -a -m "line three. re #3222." &&
- git checkout master &&
- git merge --no-ff --no-commit topic1 &&
- git commit -F .git/MERGE_MSG
-'
-
-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_expect_success 'accepts hand-editted merge' '
+ git checkout topic1 &&
+ echo "$test_name" >>file &&
+ git commit -a -m "line three. re #3222." &&
+ git checkout master &&
+ git merge --no-ff --no-commit topic1 &&
+ git commit -F .git/MERGE_MSG
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='client checkout auto-set branch rebase=true'
-
-. ./test-lib.sh
-
-test_expect_success 'setup' '
- echo "setup" >file &&
- git add file &&
- git commit -m "setup" &&
- git clone . ./server &&
- git remote add origin ./server &&
- git config branch.master.remote origin &&
- git config branch.master.merge refs/heads/master
-'
-
-# setup the post-checkout hook
-install_post_checkout_hook 'post-checkout-rebase'
-
-test_expect_success 'sets rebase on new topic branch' '
- ! git config --list | grep branch.master.rebase &&
- git checkout -b topic master &&
- git config --list | grep branch.topic.rebase=true
-'
-
-test_expect_success 'checking out remote branch does nothing' '
- git push origin topic:topic2 &&
- git fetch &&
- git checkout origin/topic2 &&
- ! git config --list | grep "branch..rebase"
-'
-
-test_expect_success 'cloning stable sets up the correct merge' '
- git push origin topic:stable &&
- git fetch &&
- git checkout -b topic3 origin/stable &&
- test "refs/heads/topic3" = "$(git config branch.topic3.merge)"
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='client checkout auto-set branch rebase=true'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo "setup" >file &&
+ git add file &&
+ git commit -m "setup" &&
+ git clone . ./server &&
+ git remote add origin ./server &&
+ git config branch.master.remote origin &&
+ git config branch.master.merge refs/heads/master
+'
+
+# setup the post-checkout hook
+install_post_checkout_hook 'post-checkout-rebase'
+
+test_expect_success 'sets rebase on new topic branch' '
+ ! git config --list | grep branch.master.rebase &&
+ git checkout -b topic master &&
+ git config --list | grep branch.topic.rebase=true
+'
+
+test_expect_success 'checking out remote branch does nothing' '
+ git push origin topic:topic2 &&
+ git fetch &&
+ git checkout origin/topic2 &&
+ ! git config --list | grep "branch..rebase"
+'
+
+test_expect_success 'cloning stable sets up the correct merge' '
+ git push origin topic:stable &&
+ git fetch &&
+ git checkout -b topic3 origin/stable &&
+ test "refs/heads/topic3" = "$(git config branch.topic3.merge)"
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update 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 update hook
-install_update_hook 'update-ensure-ticket-reference'
-
-test_expect_success 'reject with bad message' '
- echo $test_name >a &&
- git commit -a -m "$test_name" &&
- head=$(git rev-parse HEAD) &&
- ! git push 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 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 update 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 update hook
+install_update_hook 'update-ensure-ticket-reference'
+
+test_expect_success 'reject with bad message' '
+ echo $test_name >a &&
+ git commit -a -m "$test_name" &&
+ head=$(git rev-parse HEAD) &&
+ ! git push 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 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 update 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_update_hook 'update-ensure-ticket-reference'
-
-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 update 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_update_hook 'update-ensure-ticket-reference'
+
+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 update 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_update_hook 'update-ensure-ticket-reference'
-
-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_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
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update 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_update_hook 'update-ensure-ticket-reference'
+
+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_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
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update stable enforcer'
-
-. ./test-lib.sh
-
-test_expect_success 'setup' '
- echo setup >a &&
- git add a &&
- git commit -m "a" &&
- git clone ./. server &&
- git remote add origin ./server &&
- rm -fr server/.git/hooks
-'
-
-# setup the update hook
-install_update_hook 'update-stable'
-
-test_expect_success 'initial stable commit works' '
- # do one stable-less commit
- echo $test_name >a &&
- git commit -a -m "$test_name" &&
- git push origin master &&
-
- git checkout -b stable &&
- git push origin stable &&
- git config --add branch.stable.remote origin &&
- git config --add branch.stable.merge refs/heads/stable
-'
-
-test_expect_success 'reject commit directly to stable' '
- echo $test_name >a &&
- git commit -a -m "$test_name going onto stable" &&
- head=$(git rev-parse HEAD) &&
- ! git push 2>push.err &&
- cat push.err | grep "Moving stable must entail a merge commit" &&
- git reset --hard HEAD^
-'
-
-test_expect_success 'reject fast-forward to candidate branch' '
- # make one topic branch
- git checkout -b topic1 stable &&
- echo $test_name >topic1 &&
- git add topic1 &&
- git commit -m "$test_name topic1" &&
- git push origin topic1 &&
-
- git checkout stable &&
- git merge topic1 >merge.out &&
- cat merge.out | grep "Fast forward" &&
- ! git push 2>push.err &&
- cat push.err | grep "Moving stable must entail a single commit" &&
- git reset --hard ORIG_HEAD
-'
-
-test_expect_success 'reject merge with wrong first-parent' '
- # make one topic branch
- git checkout -b topic2 stable &&
- echo $test_name >topic2 &&
- git add topic2 &&
- git commit -m "$test_name topic2" &&
- git push origin topic2 &&
-
- # move ahead stable by topic3
- git checkout -b topic3 stable &&
- echo $test_name >topic3 &&
- git add topic3 &&
- git commit -m "$test_name topic3" &&
- git push origin topic3 &&
- git checkout stable &&
- git merge --no-ff topic3 &&
- git push &&
-
- # back to topic2, merge in stable, and try to push it out as the new stable
- git checkout topic2 &&
- git merge stable &&
- ! git push origin topic2:refs/heads/stable 2>push.err &&
- cat push.err | grep "Moving stable must have the previous stable as the first parent" &&
-
- # Go ahead and push topic2 itself
- git push &&
-
- # but merging into stable should still work fine
- git checkout stable &&
- git merge --no-ff topic2 &&
- git push
-'
-
-test_expect_success 'reject merge with changes' '
- # make one topic branch
- git checkout -b topic4 stable &&
- echo $test_name >topic4 &&
- git add topic4 &&
- git commit -m "$test_name topic4" &&
- git push origin topic4 &&
-
- # move ahead stable by topic5
- git checkout -b topic5 stable &&
- echo $test_name >topic5 &&
- git add topic5 &&
- git commit -m "$test_name topic5" &&
- git push origin topic5 &&
- git checkout stable &&
- git merge --no-ff topic5 &&
- git push &&
-
- # try merging topic4 into stable, which will get a merge commit, but
- # it should have changes involved and so get rejected
- git checkout stable &&
- topic4_hash=$(git rev-parse topic4) &&
- git merge topic4 &&
- ! git push 2>push.err &&
- cat push.err | grep "Moving stable must not result in any changes from $topic4_hash"
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update stable enforcer'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo setup >a &&
+ git add a &&
+ git commit -m "a" &&
+ git clone ./. server &&
+ git remote add origin ./server &&
+ rm -fr server/.git/hooks
+'
+
+# setup the update hook
+install_update_hook 'update-stable'
+
+test_expect_success 'initial stable commit works' '
+ # do one stable-less commit
+ echo $test_name >a &&
+ git commit -a -m "$test_name" &&
+ git push origin master &&
+
+ git checkout -b stable &&
+ git push origin stable &&
+ git config --add branch.stable.remote origin &&
+ git config --add branch.stable.merge refs/heads/stable
+'
+
+test_expect_success 'reject commit directly to stable' '
+ echo $test_name >a &&
+ git commit -a -m "$test_name going onto stable" &&
+ head=$(git rev-parse HEAD) &&
+ ! git push 2>push.err &&
+ cat push.err | grep "Moving stable must entail a merge commit" &&
+ git reset --hard HEAD^
+'
+
+test_expect_success 'reject fast-forward to candidate branch' '
+ # make one topic branch
+ git checkout -b topic1 stable &&
+ echo $test_name >topic1 &&
+ git add topic1 &&
+ git commit -m "$test_name topic1" &&
+ git push origin topic1 &&
+
+ git checkout stable &&
+ git merge topic1 >merge.out &&
+ cat merge.out | grep "Fast forward" &&
+ ! git push 2>push.err &&
+ cat push.err | grep "Moving stable must entail a single commit" &&
+ git reset --hard ORIG_HEAD
+'
+
+test_expect_success 'reject merge with wrong first-parent' '
+ # make one topic branch
+ git checkout -b topic2 stable &&
+ echo $test_name >topic2 &&
+ git add topic2 &&
+ git commit -m "$test_name topic2" &&
+ git push origin topic2 &&
+
+ # move ahead stable by topic3
+ git checkout -b topic3 stable &&
+ echo $test_name >topic3 &&
+ git add topic3 &&
+ git commit -m "$test_name topic3" &&
+ git push origin topic3 &&
+ git checkout stable &&
+ git merge --no-ff topic3 &&
+ git push &&
+
+ # back to topic2, merge in stable, and try to push it out as the new stable
+ git checkout topic2 &&
+ git merge stable &&
+ ! git push origin topic2:refs/heads/stable 2>push.err &&
+ cat push.err | grep "Moving stable must have the previous stable as the first parent" &&
+
+ # Go ahead and push topic2 itself
+ git push &&
+
+ # but merging into stable should still work fine
+ git checkout stable &&
+ git merge --no-ff topic2 &&
+ git push
+'
+
+test_expect_success 'reject merge with changes' '
+ # make one topic branch
+ git checkout -b topic4 stable &&
+ echo $test_name >topic4 &&
+ git add topic4 &&
+ git commit -m "$test_name topic4" &&
+ git push origin topic4 &&
+
+ # move ahead stable by topic5
+ git checkout -b topic5 stable &&
+ echo $test_name >topic5 &&
+ git add topic5 &&
+ git commit -m "$test_name topic5" &&
+ git push origin topic5 &&
+ git checkout stable &&
+ git merge --no-ff topic5 &&
+ git push &&
+
+ # try merging topic4 into stable, which will get a merge commit, but
+ # it should have changes involved and so get rejected
+ git checkout stable &&
+ topic4_hash=$(git rev-parse topic4) &&
+ git merge topic4 &&
+ ! git push 2>push.err &&
+ cat push.err | grep "Moving stable must not result in any changes from $topic4_hash"
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update stable enforcer still works with prefer rebased'
-
-. ./test-lib.sh
-
-test_expect_success 'setup' '
- echo setup >a &&
- git add a &&
- git commit -m "a" &&
- git clone ./. server &&
- git remote add origin ./server &&
- rm -fr server/.git/hooks
-'
-
-# setup the update hook
-install_update_hook 'update-stable' 'update-prefer-rebase'
-
-test_expect_success 'initial stable commit works' '
- # do one stable-less commit
- echo $test_name >a &&
- git commit -a -m "$test_name" &&
- git push origin master &&
-
- git checkout -b stable &&
- git push origin stable &&
- git config --add branch.stable.remote origin &&
- git config --add branch.stable.merge refs/heads/stable
-'
-
-test_expect_success 'accept merge' '
- # make one topic branch
- git checkout -b topic1 stable &&
- echo $test_name >topic1 &&
- git add topic1 &&
- git commit -m "$test_name topic1" &&
- git push origin topic1 &&
-
- # try merging topic1 into stable, which will get a merge commit, but
- # it should have changes involved and so get rejected
- git checkout stable &&
- git merge --no-ff topic1 &&
- git push
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update stable enforcer still works with prefer rebased'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo setup >a &&
+ git add a &&
+ git commit -m "a" &&
+ git clone ./. server &&
+ git remote add origin ./server &&
+ rm -fr server/.git/hooks
+'
+
+# setup the update hook
+install_update_hook 'update-stable' 'update-prefer-rebase'
+
+test_expect_success 'initial stable commit works' '
+ # do one stable-less commit
+ echo $test_name >a &&
+ git commit -a -m "$test_name" &&
+ git push origin master &&
+
+ git checkout -b stable &&
+ git push origin stable &&
+ git config --add branch.stable.remote origin &&
+ git config --add branch.stable.merge refs/heads/stable
+'
+
+test_expect_success 'accept merge' '
+ # make one topic branch
+ git checkout -b topic1 stable &&
+ echo $test_name >topic1 &&
+ git add topic1 &&
+ git commit -m "$test_name topic1" &&
+ git push origin topic1 &&
+
+ # try merging topic1 into stable, which will get a merge commit, but
+ # it should have changes involved and so get rejected
+ git checkout stable &&
+ git merge --no-ff topic1 &&
+ git push
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update candidate enforcer'
-
-. ./test-lib.sh
-
-test_expect_success 'setup' '
- echo setup >a &&
- git add a &&
- git commit -m "a" &&
- git clone ./. server &&
- git remote add origin ./server &&
- rm -fr server/.git/hooks
-'
-
-# setup the update hook
-install_update_hook 'update-stable'
-
-test_expect_success 'initial stable commit works' '
- # do one stable-less commit
- echo $test_name >a &&
- git commit -a -m "$test_name" &&
- git push origin master &&
-
- git checkout -b stable &&
- git push origin stable &&
- git config --add branch.stable.remote origin &&
- git config --add branch.stable.merge refs/heads/stable
-'
-
-test_expect_success 'create topic1 and topic2' '
- git checkout -b topic1 stable &&
- echo "$test_name topic1" >a.topic1 &&
- git add a.topic1 &&
- git commit -m "start topic1" &&
-
- git checkout -b topic2 stable &&
- echo "$test_name topic2" >a.topic2 &&
- git add a.topic2 &&
- git commit -m "start topic2" &&
-
- git push origin topic2 topic1
-'
-
-test_expect_success 'create candidate1' '
- git checkout -b candidate1 stable &&
- git merge topic1 topic2 &&
- git push origin candidate1
-'
-
-test_expect_success '0-commit branches are not caught by future stable' '
- git checkout -b topic4 stable &&
- git push origin topic4 &&
-
- echo "$test_name" > a &&
- git commit -a -m "$test_name" &&
- git push origin topic4
-'
-
-test_expect_success 'topic1 cannot be changed' '
- git checkout topic1 &&
- echo "$test_name" >a.topic1 &&
- git commit -a -m "$test_name" &&
- ! git push origin topic1 2>push.err &&
- cat push.err | grep "topic1 has been merged into candidate1"
-'
-
-test_expect_success 'candidate1 can be changed' '
- git checkout candidate1 &&
- echo "$test_name" >a.topic1 &&
- git commit -a -m "$test_name" &&
- git push origin candidate1
-'
-
-test_expect_success 'merge candidate into stable' '
- git checkout stable &&
- git merge candidate1 --no-ff &&
- git push origin stable
-'
-
-test_expect_success 'candidate cannot be changed' '
- git checkout candidate1 &&
- echo "$test_name" >a.topic1 &&
- git commit -a -m "$test_name" &&
- ! git push origin candidate1 2>push.err &&
- cat push.err | grep "candidate1 has been merged into stable"
- ! cat push.err | grep "candidate1 has been merged into candidate1"
-'
-
-test_expect_success 'topic1 cannot be changed' '
- # It is already changed but error message should chagne
- git checkout topic1 &&
- ! git push origin topic1 2>push.err &&
- cat push.err | grep "topic1 has been merged into stable" &&
- git reset --hard HEAD^
-'
-
-test_expect_success 'topic3 can initially be created on stable and then moved' '
- git checkout -b topic3 stable &&
- git push origin topic3 &&
-
- echo "$test_name" >a.topic3 &&
- git add a.topic3 &&
- git commit -m "$test_name" &&
- git push origin topic3
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update candidate enforcer'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo setup >a &&
+ git add a &&
+ git commit -m "a" &&
+ git clone ./. server &&
+ git remote add origin ./server &&
+ rm -fr server/.git/hooks
+'
+
+# setup the update hook
+install_update_hook 'update-stable'
+
+test_expect_success 'initial stable commit works' '
+ # do one stable-less commit
+ echo $test_name >a &&
+ git commit -a -m "$test_name" &&
+ git push origin master &&
+
+ git checkout -b stable &&
+ git push origin stable &&
+ git config --add branch.stable.remote origin &&
+ git config --add branch.stable.merge refs/heads/stable
+'
+
+test_expect_success 'create topic1 and topic2' '
+ git checkout -b topic1 stable &&
+ echo "$test_name topic1" >a.topic1 &&
+ git add a.topic1 &&
+ git commit -m "start topic1" &&
+
+ git checkout -b topic2 stable &&
+ echo "$test_name topic2" >a.topic2 &&
+ git add a.topic2 &&
+ git commit -m "start topic2" &&
+
+ git push origin topic2 topic1
+'
+
+test_expect_success 'create candidate1' '
+ git checkout -b candidate1 stable &&
+ git merge topic1 topic2 &&
+ git push origin candidate1
+'
+
+test_expect_success '0-commit branches are not caught by future stable' '
+ git checkout -b topic4 stable &&
+ git push origin topic4 &&
+
+ echo "$test_name" > a &&
+ git commit -a -m "$test_name" &&
+ git push origin topic4
+'
+
+test_expect_success 'topic1 cannot be changed' '
+ git checkout topic1 &&
+ echo "$test_name" >a.topic1 &&
+ git commit -a -m "$test_name" &&
+ ! git push origin topic1 2>push.err &&
+ cat push.err | grep "topic1 has been merged into candidate1"
+'
+
+test_expect_success 'candidate1 can be changed' '
+ git checkout candidate1 &&
+ echo "$test_name" >a.topic1 &&
+ git commit -a -m "$test_name" &&
+ git push origin candidate1
+'
+
+test_expect_success 'merge candidate into stable' '
+ git checkout stable &&
+ git merge candidate1 --no-ff &&
+ git push origin stable
+'
+
+test_expect_success 'candidate cannot be changed' '
+ git checkout candidate1 &&
+ echo "$test_name" >a.topic1 &&
+ git commit -a -m "$test_name" &&
+ ! git push origin candidate1 2>push.err &&
+ cat push.err | grep "candidate1 has been merged into stable"
+ ! cat push.err | grep "candidate1 has been merged into candidate1"
+'
+
+test_expect_success 'topic1 cannot be changed' '
+ # It is already changed but error message should chagne
+ git checkout topic1 &&
+ ! git push origin topic1 2>push.err &&
+ cat push.err | grep "topic1 has been merged into stable" &&
+ git reset --hard HEAD^
+'
+
+test_expect_success 'topic3 can initially be created on stable and then moved' '
+ git checkout -b topic3 stable &&
+ git push origin topic3 &&
+
+ echo "$test_name" >a.topic3 &&
+ git add a.topic3 &&
+ git commit -m "$test_name" &&
+ git push origin topic3
+'
+
+test_done
+
--- /dev/null
+#!/bin/sh
+
+test_description='server post-receive email notification'
+
+. ./test-lib.sh
+
+export USER_EMAIL=author@example.com
+
+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 branch.master.remote origin &&
+ git config branch.master.merge refs/heads/master &&
+ GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
+ GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
+ echo cbas >./server/.git/description
+'
+
+install_post_receive_hook 'post-receive-email'
+
+test_expect_success 'simple commit' '
+ old_commit_hash=$(git rev-parse HEAD) &&
+ old_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ echo $test_name >a &&
+ git commit -a -m "$test_name" &&
+ git push &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+ new_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ interpolate ../t2200-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_date new_commit_abbrev &&
+ test_cmp 1.txt server/.git/refs.heads.master.out
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server post-receive email notification'
-
-. ./test-lib.sh
-
-export USER_EMAIL=author@example.com
-
-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 branch.master.remote origin &&
- git config branch.master.merge refs/heads/master &&
- GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
- GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
- echo cbas >./server/.git/description
-'
-
-install_post_receive_hook 'post-receive-email'
-
-test_expect_success 'simple commit' '
- old_commit_hash=$(git rev-parse HEAD) &&
- old_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- echo $test_name >a &&
- git commit -a -m "$test_name" &&
- git push &&
- new_commit_hash=$(git rev-parse HEAD) &&
- new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
- new_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- interpolate ../t2200-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_date new_commit_abbrev &&
- test_cmp 1.txt server/.git/refs.heads.master.out
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server post-receive email notification'
+
+. ./test-lib.sh
+
+export USER_EMAIL=author@example.com
+
+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 branch.master.remote origin &&
+ git config branch.master.merge refs/heads/master &&
+ GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
+ GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
+ echo cbas >./server/.git/description
+'
+
+install_post_receive_hook 'post-receive-email'
+
+test_expect_success 'create annotated tag' '
+ git tag -a -m 1.0 1.0 &&
+ git push --tags &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ tag_hash=$(git rev-parse 1.0) &&
+ eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/1.0) &&
+
+ interpolate ../t2201-1.txt 1.txt new_commit_hash tag_hash tag_date &&
+ test_cmp 1.txt server/.git/refs.tags.1.0.out
+'
+
+test_expect_success 'commit on annotated tagged branch' '
+ old_commit_hash=$(git rev-parse HEAD) &&
+ old_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name" &&
+ prior_commit_hash=$(git rev-parse HEAD) &&
+ prior_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+ prior_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ echo "$test_name 2" >a &&
+ git commit -a -m "$test_name 2" &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+ new_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ git push &&
+ new_commit_abbrev=$(git rev-list -n 1 --pretty=format:%h HEAD | grep -v commit) &&
+ interpolate ../t2201-2.txt 2.txt old_commit_hash new_commit_hash new_commit_date new_commit_abbrev prior_commit_hash prior_commit_date old_commit_abbrev prior_commit_abbrev new_commit_abbrev &&
+ test_cmp 2.txt server/.git/refs.heads.master.out
+'
+
+test_expect_success 're-annotated tag branch' '
+ git tag -a -m 2.0 2.0 &&
+ git push --tags &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ tag_hash=$(git rev-parse 2.0) &&
+ eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
+
+ interpolate ../t2201-3.txt 3.txt new_commit_hash tag_hash tag_date &&
+ test_cmp 3.txt server/.git/refs.tags.2.0.out
+'
+
+test_expect_success 'force update annotated tag' '
+ old_tag_hash=$(git rev-parse 2.0) &&
+
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name" &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+
+ git tag -f -a -m 2.0 2.0 &&
+ git push --tags &&
+ new_tag_hash=$(git rev-parse 2.0) &&
+ eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
+
+ interpolate ../t2201-7.txt 7.txt old_tag_hash new_commit_hash new_tag_hash tag_date &&
+ test_cmp 7.txt server/.git/refs.tags.2.0.out
+'
+
+test_expect_success 'delete annotated tag' '
+ old_tag_hash=$(git rev-parse 2.0) &&
+ eval $(git for-each-ref --shell "--format=old_tag_date=%(taggerdate)" refs/tags/2.0) &&
+
+ git tag -d 2.0 &&
+ git push origin :refs/tags/2.0 &&
+
+ new_commit_describe=$(git describe HEAD) &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+
+ interpolate ../t2201-8.txt 8.txt old_tag_hash old_tag_date new_commit_describe new_commit_hash &&
+ test_cmp 8.txt server/.git/refs.tags.2.0.out
+'
+
+test_expect_success 'create lightweight tag' '
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name" &&
+ git push &&
+
+ git tag 2.1 &&
+ git push --tags &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_describe=$(git describe HEAD) &&
+ new_commit_date=$(git rev-list --no-walk --pretty=format:%ad HEAD | tail -n 1) &&
+
+ interpolate ../t2201-4.txt 4.txt new_commit_hash new_commit_describe new_commit_date &&
+ test_cmp 4.txt server/.git/refs.tags.2.1.out
+'
+
+test_expect_success 'force update lightweight tag' '
+ old_commit_hash=$(git rev-parse HEAD) &&
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name" &&
+ git push &&
+
+ git tag -f 2.1 &&
+ git push --tags &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_describe=$(git describe HEAD) &&
+ new_commit_date=$(git rev-list --no-walk --pretty=format:%ad HEAD | tail -n 1) &&
+
+ interpolate ../t2201-5.txt 5.txt new_commit_hash new_commit_describe new_commit_date old_commit_hash &&
+ test_cmp 5.txt server/.git/refs.tags.2.1.out
+'
+
+test_expect_success 'delete lightweight tag' '
+ old_commit_hash=$(git rev-parse HEAD) &&
+ old_commit_describe=$(git describe HEAD) &&
+ git tag -d 2.1 &&
+ git push origin :refs/tags/2.1 &&
+
+ interpolate ../t2201-6.txt 6.txt old_commit_hash old_commit_describe &&
+ test_cmp 6.txt server/.git/refs.tags.2.1.out
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server post-receive email notification'
-
-. ./test-lib.sh
-
-export USER_EMAIL=author@example.com
-
-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 branch.master.remote origin &&
- git config branch.master.merge refs/heads/master &&
- GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
- GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
- echo cbas >./server/.git/description
-'
-
-install_post_receive_hook 'post-receive-email'
-
-test_expect_success 'create annotated tag' '
- git tag -a -m 1.0 1.0 &&
- git push --tags &&
- new_commit_hash=$(git rev-parse HEAD) &&
- tag_hash=$(git rev-parse 1.0) &&
- eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/1.0) &&
-
- interpolate ../t2201-1.txt 1.txt new_commit_hash tag_hash tag_date &&
- test_cmp 1.txt server/.git/refs.tags.1.0.out
-'
-
-test_expect_success 'commit on annotated tagged branch' '
- old_commit_hash=$(git rev-parse HEAD) &&
- old_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- echo "$test_name" >a &&
- git commit -a -m "$test_name" &&
- prior_commit_hash=$(git rev-parse HEAD) &&
- prior_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
- prior_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- echo "$test_name 2" >a &&
- git commit -a -m "$test_name 2" &&
- new_commit_hash=$(git rev-parse HEAD) &&
- new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
- new_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- git push &&
- new_commit_abbrev=$(git rev-list -n 1 --pretty=format:%h HEAD | grep -v commit) &&
- interpolate ../t2201-2.txt 2.txt old_commit_hash new_commit_hash new_commit_date new_commit_abbrev prior_commit_hash prior_commit_date old_commit_abbrev prior_commit_abbrev new_commit_abbrev &&
- test_cmp 2.txt server/.git/refs.heads.master.out
-'
-
-test_expect_success 're-annotated tag branch' '
- git tag -a -m 2.0 2.0 &&
- git push --tags &&
- new_commit_hash=$(git rev-parse HEAD) &&
- tag_hash=$(git rev-parse 2.0) &&
- eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
-
- interpolate ../t2201-3.txt 3.txt new_commit_hash tag_hash tag_date &&
- test_cmp 3.txt server/.git/refs.tags.2.0.out
-'
-
-test_expect_success 'force update annotated tag' '
- old_tag_hash=$(git rev-parse 2.0) &&
-
- echo "$test_name" >a &&
- git commit -a -m "$test_name" &&
- new_commit_hash=$(git rev-parse HEAD) &&
- new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
-
- git tag -f -a -m 2.0 2.0 &&
- git push --tags &&
- new_tag_hash=$(git rev-parse 2.0) &&
- eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
-
- interpolate ../t2201-7.txt 7.txt old_tag_hash new_commit_hash new_tag_hash tag_date &&
- test_cmp 7.txt server/.git/refs.tags.2.0.out
-'
-
-test_expect_success 'delete annotated tag' '
- old_tag_hash=$(git rev-parse 2.0) &&
- eval $(git for-each-ref --shell "--format=old_tag_date=%(taggerdate)" refs/tags/2.0) &&
-
- git tag -d 2.0 &&
- git push origin :refs/tags/2.0 &&
-
- new_commit_describe=$(git describe HEAD) &&
- new_commit_hash=$(git rev-parse HEAD) &&
-
- interpolate ../t2201-8.txt 8.txt old_tag_hash old_tag_date new_commit_describe new_commit_hash &&
- test_cmp 8.txt server/.git/refs.tags.2.0.out
-'
-
-test_expect_success 'create lightweight tag' '
- echo "$test_name" >a &&
- git commit -a -m "$test_name" &&
- git push &&
-
- git tag 2.1 &&
- git push --tags &&
- new_commit_hash=$(git rev-parse HEAD) &&
- new_commit_describe=$(git describe HEAD) &&
- new_commit_date=$(git rev-list --no-walk --pretty=format:%ad HEAD | tail -n 1) &&
-
- interpolate ../t2201-4.txt 4.txt new_commit_hash new_commit_describe new_commit_date &&
- test_cmp 4.txt server/.git/refs.tags.2.1.out
-'
-
-test_expect_success 'force update lightweight tag' '
- old_commit_hash=$(git rev-parse HEAD) &&
- echo "$test_name" >a &&
- git commit -a -m "$test_name" &&
- git push &&
-
- git tag -f 2.1 &&
- git push --tags &&
- new_commit_hash=$(git rev-parse HEAD) &&
- new_commit_describe=$(git describe HEAD) &&
- new_commit_date=$(git rev-list --no-walk --pretty=format:%ad HEAD | tail -n 1) &&
-
- interpolate ../t2201-5.txt 5.txt new_commit_hash new_commit_describe new_commit_date old_commit_hash &&
- test_cmp 5.txt server/.git/refs.tags.2.1.out
-'
-
-test_expect_success 'delete lightweight tag' '
- old_commit_hash=$(git rev-parse HEAD) &&
- old_commit_describe=$(git describe HEAD) &&
- git tag -d 2.1 &&
- git push origin :refs/tags/2.1 &&
-
- interpolate ../t2201-6.txt 6.txt old_commit_hash old_commit_describe &&
- test_cmp 6.txt server/.git/refs.tags.2.1.out
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server post-receive email notification'
+
+. ./test-lib.sh
+
+export USER_EMAIL=author@example.com
+
+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 branch.master.remote origin &&
+ git config branch.master.merge refs/heads/master &&
+ GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
+ GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
+ echo cbas >./server/.git/description
+'
+
+install_post_receive_hook 'post-receive-email'
+
+test_expect_success 'create branch' '
+ git checkout -b topic master &&
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name on topic" &&
+ prior_commit_hash=$(git rev-parse HEAD) &&
+ prior_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+
+ echo "$test_name 2" >a &&
+ git commit -a -m "$test_name on topic 2 " &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_abbrev=$(git rev-parse --short HEAD) &&
+ new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+
+ git push origin topic &&
+
+ interpolate ../t2202-1.txt 1.txt new_commit_hash new_commit_abbrev new_commit_date prior_commit_hash prior_commit_date &&
+ test_cmp 1.txt server/.git/refs.heads.topic.out
+'
+
+test_expect_success 'create branch with existing commits does not replay them' '
+ git checkout -b topic2 topic &&
+ existing_commit_hash=$(git rev-parse HEAD) &&
+ existing_commit_abbrev=$(git rev-parse --short HEAD) &&
+ existing_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+
+ git push origin topic2 &&
+
+ interpolate ../t2202-3.txt 3.txt existing_commit_hash existing_commit_abbrev existing_commit_date &&
+ test_cmp 3.txt server/.git/refs.heads.topic2.out
+'
+
+test_expect_success 'update branch with existing commits does not replay them' '
+ # Put a commit on topic2, then fast foward topic to it
+ git checkout topic2 &&
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name on topic" &&
+ git push &&
+
+ git checkout topic &&
+ old_commit_hash=$(git rev-parse HEAD) &&
+ old_commit_abbrev=$(git rev-parse --short HEAD) &&
+ git merge topic2 &&
+ existing_commit_hash=$(git rev-parse HEAD) &&
+ existing_commit_abbrev=$(git rev-parse --short HEAD) &&
+ git push &&
+
+ interpolate ../t2202-4.txt 4.txt old_commit_hash old_commit_abbrev existing_commit_hash existing_commit_abbrev &&
+ test_cmp 4.txt server/.git/refs.heads.topic.out
+'
+
+test_expect_success 'rewind branch' '
+ git checkout topic &&
+ old_commit_hash=$(git rev-parse HEAD) &&
+ old_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ git reset --hard HEAD^ &&
+ git push --force &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+
+ interpolate ../t2202-5.txt 5.txt old_commit_hash new_commit_hash old_commit_abbrev &&
+ test_cmp 5.txt server/.git/refs.heads.topic.out
+'
+
+test_expect_success 'rewind and continue branch' '
+ git checkout topic &&
+ old_commit_hash=$(git rev-parse HEAD) &&
+ old_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ git reset --hard HEAD^ &&
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name on topic" &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_abbrev=$(git rev-parse --short HEAD) &&
+ new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+
+ git push --force &&
+ interpolate ../t2202-6.txt 6.txt old_commit_hash new_commit_hash new_commit_date new_commit_abbrev old_commit_abbrev &&
+ test_cmp 6.txt server/.git/refs.heads.topic.out
+'
+
+test_expect_success 'delete branch' '
+ old_commit_hash=$(git rev-parse HEAD) &&
+ git push origin :refs/heads/topic &&
+
+ interpolate ../t2202-2.txt 2.txt old_commit_hash &&
+ test_cmp 2.txt server/.git/refs.heads.topic.out
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server post-receive email notification'
-
-. ./test-lib.sh
-
-export USER_EMAIL=author@example.com
-
-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 branch.master.remote origin &&
- git config branch.master.merge refs/heads/master &&
- GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
- GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
- echo cbas >./server/.git/description
-'
-
-install_post_receive_hook 'post-receive-email'
-
-test_expect_success 'create branch' '
- git checkout -b topic master &&
- echo "$test_name" >a &&
- git commit -a -m "$test_name on topic" &&
- prior_commit_hash=$(git rev-parse HEAD) &&
- prior_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
-
- echo "$test_name 2" >a &&
- git commit -a -m "$test_name on topic 2 " &&
- new_commit_hash=$(git rev-parse HEAD) &&
- new_commit_abbrev=$(git rev-parse --short HEAD) &&
- new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
-
- git push origin topic &&
-
- interpolate ../t2202-1.txt 1.txt new_commit_hash new_commit_abbrev new_commit_date prior_commit_hash prior_commit_date &&
- test_cmp 1.txt server/.git/refs.heads.topic.out
-'
-
-test_expect_success 'create branch with existing commits does not replay them' '
- git checkout -b topic2 topic &&
- existing_commit_hash=$(git rev-parse HEAD) &&
- existing_commit_abbrev=$(git rev-parse --short HEAD) &&
- existing_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
-
- git push origin topic2 &&
-
- interpolate ../t2202-3.txt 3.txt existing_commit_hash existing_commit_abbrev existing_commit_date &&
- test_cmp 3.txt server/.git/refs.heads.topic2.out
-'
-
-test_expect_success 'update branch with existing commits does not replay them' '
- # Put a commit on topic2, then fast foward topic to it
- git checkout topic2 &&
- echo "$test_name" >a &&
- git commit -a -m "$test_name on topic" &&
- git push &&
-
- git checkout topic &&
- old_commit_hash=$(git rev-parse HEAD) &&
- old_commit_abbrev=$(git rev-parse --short HEAD) &&
- git merge topic2 &&
- existing_commit_hash=$(git rev-parse HEAD) &&
- existing_commit_abbrev=$(git rev-parse --short HEAD) &&
- git push &&
-
- interpolate ../t2202-4.txt 4.txt old_commit_hash old_commit_abbrev existing_commit_hash existing_commit_abbrev &&
- test_cmp 4.txt server/.git/refs.heads.topic.out
-'
-
-test_expect_success 'rewind branch' '
- git checkout topic &&
- old_commit_hash=$(git rev-parse HEAD) &&
- old_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- git reset --hard HEAD^ &&
- git push --force &&
- new_commit_hash=$(git rev-parse HEAD) &&
-
- interpolate ../t2202-5.txt 5.txt old_commit_hash new_commit_hash old_commit_abbrev &&
- test_cmp 5.txt server/.git/refs.heads.topic.out
-'
-
-test_expect_success 'rewind and continue branch' '
- git checkout topic &&
- old_commit_hash=$(git rev-parse HEAD) &&
- old_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- git reset --hard HEAD^ &&
- echo "$test_name" >a &&
- git commit -a -m "$test_name on topic" &&
- new_commit_hash=$(git rev-parse HEAD) &&
- new_commit_abbrev=$(git rev-parse --short HEAD) &&
- new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
-
- git push --force &&
- interpolate ../t2202-6.txt 6.txt old_commit_hash new_commit_hash new_commit_date new_commit_abbrev old_commit_abbrev &&
- test_cmp 6.txt server/.git/refs.heads.topic.out
-'
-
-test_expect_success 'delete branch' '
- old_commit_hash=$(git rev-parse HEAD) &&
- git push origin :refs/heads/topic &&
-
- interpolate ../t2202-2.txt 2.txt old_commit_hash &&
- test_cmp 2.txt server/.git/refs.heads.topic.out
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server post-receive email notification and how it behaves in our stable-based envrionment'
+
+. ./test-lib.sh
+
+export USER_EMAIL=author@example.com
+
+test_expect_success 'setup' '
+ echo "setup" >a &&
+ echo "setup" >b &&
+ echo "setup" >c &&
+ git add a b c &&
+ git commit -m "setup" &&
+ git clone ./. server &&
+ rm -fr server/.git/hooks &&
+ git remote add origin ./server &&
+ git config branch.master.remote origin &&
+ git config branch.master.merge refs/heads/master &&
+ GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
+ GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
+ echo cbas >./server/.git/description &&
+
+ git checkout -b stable &&
+ git push origin stable
+'
+
+install_post_receive_hook 'post-receive-email'
+
+test_expect_success 'merge in stable' '
+ git checkout -b topic1 stable &&
+ echo "move" >a.topic1 &&
+ git add a.topic1 &&
+ git commit -a -m "move topic1" &&
+ git push origin topic1 &&
+ old_commit_hash=$(git rev-parse HEAD) &&
+ old_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ # Move stable
+ git checkout stable &&
+ echo "$test_name 1" >a &&
+ echo "$test_name 1" >b &&
+ echo "$test_name 1" >c &&
+ git commit -a -m "move stable 1" &&
+ first_stable_hash=$(git rev-parse HEAD) &&
+
+ echo "$test_name 2" >a &&
+ echo "$test_name 2" >b &&
+ echo "$test_name 2" >c &&
+ git commit -a -m "move stable 2" &&
+ second_stable_hash=$(git rev-parse HEAD) &&
+ git push origin stable &&
+
+ # Merge stable
+ git checkout topic1 &&
+ git merge stable &&
+ git push &&
+
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+ new_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ interpolate ../t2203-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date first_stable_hash second_stable_hash &&
+ test_cmp 1.txt server/.git/refs.heads.topic1.out
+'
+
+test_expect_success 'merge in stable with conflict' '
+ git checkout topic1 &&
+ echo "$test_name on topic1" >a &&
+ git commit -a -m "move topic1" &&
+ git push origin topic1 &&
+ old_commit_hash=$(git rev-parse HEAD) &&
+ old_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ # Move stable
+ git checkout stable &&
+ echo "$test_name 1" >a &&
+ echo "$test_name 1" >b &&
+ echo "$test_name 1" >c &&
+ git commit -a -m "move stable 1" &&
+ first_stable_hash=$(git rev-parse HEAD) &&
+
+ echo "$test_name 2" >a &&
+ echo "$test_name 2" >b &&
+ echo "$test_name 2" >c &&
+ git commit -a -m "move stable 2" &&
+ second_stable_hash=$(git rev-parse HEAD) &&
+ git push origin stable &&
+
+ # Merge stable
+ git checkout topic1 &&
+ ! git merge stable &&
+ echo "$test_name 2 merged topic1" >a &&
+ git add a &&
+ git commit -F .git/MERGE_MSG
+ git push &&
+
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+ new_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ interpolate ../t2203-2.txt 2.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date first_stable_hash second_stable_hash &&
+ test_cmp 2.txt server/.git/refs.heads.topic1.out
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server post-receive email notification and how it behaves in our stable-based envrionment'
-
-. ./test-lib.sh
-
-export USER_EMAIL=author@example.com
-
-test_expect_success 'setup' '
- echo "setup" >a &&
- echo "setup" >b &&
- echo "setup" >c &&
- git add a b c &&
- git commit -m "setup" &&
- git clone ./. server &&
- rm -fr server/.git/hooks &&
- git remote add origin ./server &&
- git config branch.master.remote origin &&
- git config branch.master.merge refs/heads/master &&
- GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
- GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
- echo cbas >./server/.git/description &&
-
- git checkout -b stable &&
- git push origin stable
-'
-
-install_post_receive_hook 'post-receive-email'
-
-test_expect_success 'merge in stable' '
- git checkout -b topic1 stable &&
- echo "move" >a.topic1 &&
- git add a.topic1 &&
- git commit -a -m "move topic1" &&
- git push origin topic1 &&
- old_commit_hash=$(git rev-parse HEAD) &&
- old_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- # Move stable
- git checkout stable &&
- echo "$test_name 1" >a &&
- echo "$test_name 1" >b &&
- echo "$test_name 1" >c &&
- git commit -a -m "move stable 1" &&
- first_stable_hash=$(git rev-parse HEAD) &&
-
- echo "$test_name 2" >a &&
- echo "$test_name 2" >b &&
- echo "$test_name 2" >c &&
- git commit -a -m "move stable 2" &&
- second_stable_hash=$(git rev-parse HEAD) &&
- git push origin stable &&
-
- # Merge stable
- git checkout topic1 &&
- git merge stable &&
- git push &&
-
- new_commit_hash=$(git rev-parse HEAD) &&
- new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
- new_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- interpolate ../t2203-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date first_stable_hash second_stable_hash &&
- test_cmp 1.txt server/.git/refs.heads.topic1.out
-'
-
-test_expect_success 'merge in stable with conflict' '
- git checkout topic1 &&
- echo "$test_name on topic1" >a &&
- git commit -a -m "move topic1" &&
- git push origin topic1 &&
- old_commit_hash=$(git rev-parse HEAD) &&
- old_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- # Move stable
- git checkout stable &&
- echo "$test_name 1" >a &&
- echo "$test_name 1" >b &&
- echo "$test_name 1" >c &&
- git commit -a -m "move stable 1" &&
- first_stable_hash=$(git rev-parse HEAD) &&
-
- echo "$test_name 2" >a &&
- echo "$test_name 2" >b &&
- echo "$test_name 2" >c &&
- git commit -a -m "move stable 2" &&
- second_stable_hash=$(git rev-parse HEAD) &&
- git push origin stable &&
-
- # Merge stable
- git checkout topic1 &&
- ! git merge stable &&
- echo "$test_name 2 merged topic1" >a &&
- git add a &&
- git commit -F .git/MERGE_MSG
- git push &&
-
- new_commit_hash=$(git rev-parse HEAD) &&
- new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
- new_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- interpolate ../t2203-2.txt 2.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date first_stable_hash second_stable_hash &&
- test_cmp 2.txt server/.git/refs.heads.topic1.out
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server post-receive email notification and how it behaves in our stable-based envrionment'
+
+. ./test-lib.sh
+
+export USER_EMAIL=author@example.com
+
+test_expect_success 'setup' '
+ echo "setup" >a &&
+ echo "setup" >b &&
+ echo "setup" >c &&
+ git add a b c &&
+ git commit -m "setup" &&
+ git clone ./. server &&
+ rm -fr server/.git/hooks &&
+ git remote add origin ./server &&
+ git config branch.master.remote origin &&
+ git config branch.master.merge refs/heads/master &&
+ GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
+ GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
+ echo cbas >./server/.git/description &&
+
+ git checkout -b stable &&
+ git push origin stable
+'
+
+install_post_receive_hook 'post-receive-email'
+
+test_expect_success 'conflict diff' '
+ git checkout stable &&
+ echo "line1" >a &&
+ echo "line2" >>a &&
+ echo "line3" >>a &&
+ git commit -a -m "lines" &&
+ git push origin stable &&
+
+ git checkout -b topic1 stable &&
+ echo "line1.topic1" >a &&
+ echo "line2.topic1" >>a &&
+ echo "line3.topic1" >>a &&
+ git commit -a -m "lines changed on topic1" &&
+ git push origin topic1 &&
+
+ old_commit_hash=$(git rev-parse HEAD) &&
+ old_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ # Move stable
+ git checkout stable &&
+ echo "line1.stable" >a &&
+ echo "line2.stable" >>a &&
+ echo "line3.stable" >>a &&
+ git commit -a -m "lines changed on stable" &&
+ git push origin stable &&
+
+ stable_hash=$(git rev-parse HEAD) &&
+
+ git checkout topic1 &&
+ ! git merge stable &&
+
+ echo "line1.topic" >a &&
+ echo "line2.stable" >>a &&
+ echo "line3.resolved" >>a &&
+ git add a &&
+ git commit -a -m "resolved lines for merging stable into topic1" &&
+ second_stable_hash=$(git rev-parse HEAD) &&
+ git push origin topic1 &&
+
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+ new_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ interpolate ../t2204-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date stable_hash &&
+ test_cmp 1.txt server/.git/refs.heads.topic1.out
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server post-receive email notification and how it behaves in our stable-based envrionment'
-
-. ./test-lib.sh
-
-export USER_EMAIL=author@example.com
-
-test_expect_success 'setup' '
- echo "setup" >a &&
- echo "setup" >b &&
- echo "setup" >c &&
- git add a b c &&
- git commit -m "setup" &&
- git clone ./. server &&
- rm -fr server/.git/hooks &&
- git remote add origin ./server &&
- git config branch.master.remote origin &&
- git config branch.master.merge refs/heads/master &&
- GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
- GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
- echo cbas >./server/.git/description &&
-
- git checkout -b stable &&
- git push origin stable
-'
-
-install_post_receive_hook 'post-receive-email'
-
-test_expect_success 'conflict diff' '
- git checkout stable &&
- echo "line1" >a &&
- echo "line2" >>a &&
- echo "line3" >>a &&
- git commit -a -m "lines" &&
- git push origin stable &&
-
- git checkout -b topic1 stable &&
- echo "line1.topic1" >a &&
- echo "line2.topic1" >>a &&
- echo "line3.topic1" >>a &&
- git commit -a -m "lines changed on topic1" &&
- git push origin topic1 &&
-
- old_commit_hash=$(git rev-parse HEAD) &&
- old_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- # Move stable
- git checkout stable &&
- echo "line1.stable" >a &&
- echo "line2.stable" >>a &&
- echo "line3.stable" >>a &&
- git commit -a -m "lines changed on stable" &&
- git push origin stable &&
-
- stable_hash=$(git rev-parse HEAD) &&
-
- git checkout topic1 &&
- ! git merge stable &&
-
- echo "line1.topic" >a &&
- echo "line2.stable" >>a &&
- echo "line3.resolved" >>a &&
- git add a &&
- git commit -a -m "resolved lines for merging stable into topic1" &&
- second_stable_hash=$(git rev-parse HEAD) &&
- git push origin topic1 &&
-
- new_commit_hash=$(git rev-parse HEAD) &&
- new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
- new_commit_abbrev=$(git rev-parse --short HEAD) &&
-
- interpolate ../t2204-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date stable_hash &&
- test_cmp 1.txt server/.git/refs.heads.topic1.out
-'
-
-test_done
-
+++ /dev/null
-#!/bin/sh
-
-test_description='server update prefer rebase'
-
-. ./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 &&
- git fetch
-'
-
-install_update_hook 'update-prefer-rebase'
-
-test_expect_success 'merge local changes is caught' '
- # make an outstanding change for us--but do not push
- echo "$test_name" >a.client1 &&
- git add a.client1 &&
- git commit -m "$test_name on client1" &&
-
- # have another client commit (in this case, it is the server, but close enough)
- cd server &&
- echo "$test_name" >a.client2 &&
- git add a.client2 &&
- git commit -m "$test_name on client2" &&
-
- # go back to our client and it will merge in our changes
- cd .. &&
- git pull &&
- merge=$(git rev-parse HEAD) &&
-
- ! git push 2>push.err &&
- cat push.err | grep "It looks like you should rebase instead of merging $merge" &&
- git reset --hard origin/master
-'
-
-test_expect_success 'merge local changes followed by more commits is caught' '
- # make an outstanding change for us--but do not push
- echo "$test_name" >a.client1 &&
- git add a.client1 &&
- git commit -m "$test_name on client1" &&
-
- # have another client commit (in this case, it is the server, but close enough)
- cd server &&
- echo "$test_name" >a.client2 &&
- git add a.client2 &&
- git commit -m "$test_name on client2" &&
-
- # go back to our client and it will merge in our changes
- cd .. &&
- git pull &&
- merge=$(git rev-parse HEAD) &&
-
- # To complicate things, have them add another change
- echo "$test_name again" >a.client1 &&
- git commit -a -m "$test_name on client1 again" &&
-
- ! git push 2>push.err &&
- cat push.err | grep "It looks like you should rebase instead of merging $merge" &&
- git reset --hard origin/master
-'
-
-test_expect_success 'merge shared changes from another topic is okay' '
- # make a change on topic for us and share it
- git checkout -b topic master &&
- echo "$test_name" >a.client1 &&
- git add a.client1 &&
- git commit -m "$test_name on client1 and topic" &&
- git push origin topic &&
-
- # make an outstanding on topic that is not pushed
- echo "$test_name again" >>a.client1 &&
- git commit -a -m "$test_name on client1 and topic again" &&
-
- # have another client commit to master (in this case, it is the server, but close enough)
- cd server &&
- echo "$test_name" >a.client2 &&
- git add a.client2 &&
- git commit -m "$test_name on client2" &&
-
- # go back to our client and it will merge in our changes
- cd .. &&
- git checkout master &&
- # this should fast fwd
- git pull &&
- # this pulls in the shared branch+its new tip
- git merge topic &&
-
- git push
-'
-
-test_expect_success 'simple commit' '
- # go back to topic and make a simple commit/push as a sanity check
- git checkout topic &&
- echo "$test_name" >>a.client1 &&
- git commit -a -m "$test_name on client1 and topic" &&
- git push
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update prefer rebase'
+
+. ./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 &&
+ git fetch
+'
+
+install_update_hook 'update-prefer-rebase'
+
+test_expect_success 'merge local changes is caught' '
+ # make an outstanding change for us--but do not push
+ echo "$test_name" >a.client1 &&
+ git add a.client1 &&
+ git commit -m "$test_name on client1" &&
+
+ # have another client commit (in this case, it is the server, but close enough)
+ cd server &&
+ echo "$test_name" >a.client2 &&
+ git add a.client2 &&
+ git commit -m "$test_name on client2" &&
+
+ # go back to our client and it will merge in our changes
+ cd .. &&
+ git pull &&
+ merge=$(git rev-parse HEAD) &&
+
+ ! git push 2>push.err &&
+ cat push.err | grep "It looks like you should rebase instead of merging $merge" &&
+ git reset --hard origin/master
+'
+
+test_expect_success 'merge local changes followed by more commits is caught' '
+ # make an outstanding change for us--but do not push
+ echo "$test_name" >a.client1 &&
+ git add a.client1 &&
+ git commit -m "$test_name on client1" &&
+
+ # have another client commit (in this case, it is the server, but close enough)
+ cd server &&
+ echo "$test_name" >a.client2 &&
+ git add a.client2 &&
+ git commit -m "$test_name on client2" &&
+
+ # go back to our client and it will merge in our changes
+ cd .. &&
+ git pull &&
+ merge=$(git rev-parse HEAD) &&
+
+ # To complicate things, have them add another change
+ echo "$test_name again" >a.client1 &&
+ git commit -a -m "$test_name on client1 again" &&
+
+ ! git push 2>push.err &&
+ cat push.err | grep "It looks like you should rebase instead of merging $merge" &&
+ git reset --hard origin/master
+'
+
+test_expect_success 'merge shared changes from another topic is okay' '
+ # make a change on topic for us and share it
+ git checkout -b topic master &&
+ echo "$test_name" >a.client1 &&
+ git add a.client1 &&
+ git commit -m "$test_name on client1 and topic" &&
+ git push origin topic &&
+
+ # make an outstanding on topic that is not pushed
+ echo "$test_name again" >>a.client1 &&
+ git commit -a -m "$test_name on client1 and topic again" &&
+
+ # have another client commit to master (in this case, it is the server, but close enough)
+ cd server &&
+ echo "$test_name" >a.client2 &&
+ git add a.client2 &&
+ git commit -m "$test_name on client2" &&
+
+ # go back to our client and it will merge in our changes
+ cd .. &&
+ git checkout master &&
+ # this should fast fwd
+ git pull &&
+ # this pulls in the shared branch+its new tip
+ git merge topic &&
+
+ git push
+'
+
+test_expect_success 'simple commit' '
+ # go back to topic and make a simple commit/push as a sanity check
+ git checkout topic &&
+ echo "$test_name" >>a.client1 &&
+ git commit -a -m "$test_name on client1 and topic" &&
+ git push
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update prefer rebase (with incoming merges)'
-
-. ./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 &&
- git fetch &&
-
- # Specifically, setup a stable that we will merge and check for rebase
- git checkout -b stable master &&
- echo "setup.stable" >a &&
- git commit -a -m "stable" &&
- git push origin stable
-'
-
-install_update_hook 'update-prefer-rebase'
-
-#
-# A -- B <-- origin/stable
-# \ |
-# C -- D <-- origin/topic1
-# \ | \
-# e - f <-- topic1
-#
-# Nope: should rebase e ontop of D
-#
-test_expect_success 'merging in stable does not fool the script' '
- # start our branch, and share it
- git checkout -b topic1 stable &&
- git config --add branch.topic1.remote origin &&
- git config --add branch.topic1.merge refs/heads/topic1 &&
- echo "topic1" >a.topic1 &&
- git add a.topic1 &&
- git commit -m "topic1" &&
- git push origin topic1 &&
-
- # now, separately, move ahead stable, and share it
- git checkout stable
- echo "setup.stable.moved" >a &&
- git commit -a -m "stable moved" &&
- git push origin stable &&
-
- # have another client commit (in this case, it is the server, but close enough) move topic1
- cd server &&
- git checkout topic1 &&
- echo "$test_name" >a.client2 &&
- git add a.client2 &&
- git commit -m "topic1 changed by client2" &&
- cd .. &&
-
- # now locally try and merge in stable (even though topic1 is out of date)
- git checkout topic1 &&
- git merge stable &&
-
- # We are shutdown for being a rewind
- ! git push 2>push.err &&
- cat push.err | grep "[rejected] topic1 -> topic1 (non-fast forward)"
-
- # Make a new merge commit
- git pull &&
- ! git push 2>push.err &&
- cat push.err | grep "It looks like you should rebase instead of merging" &&
-
- # Now fix it
- git reset --hard ORIG_HEAD &&
- GIT_EDITOR=: git rebase -i -p origin/topic1 &&
- git push &&
- git branch -r --contains stable | grep origin/topic
-'
-
-#
-# A --C------ <-- origin/stable
-# \ | \
-# B -- D -- E -- F <-- origin/topic2
-# \| \
-# g -- h ------- i <-- topic2
-#
-# Trying to push F..i
-#
-# merge-base(F, h) has two options: B and C
-#
-test_expect_success 'merging in stable with tricky double baserev does not fool the script' '
- # B: start our branch, and share it
- git checkout -b topic2 stable &&
- git config --add branch.topic2.remote origin &&
- git config --add branch.topic2.merge refs/heads/topic2 &&
- echo "commit B" >a.topic2 &&
- git add a.topic2 &&
- git commit -m "commit B created topic2" &&
- git push origin topic2 &&
-
- # C: now, separately, move ahead stable, and share it
- git checkout stable
- echo "commit C" >a &&
- git commit -a -m "commit C moved stable" &&
- git push origin stable &&
-
- # D: have another client commit (in this case, it is the server, but close enough) moves topic2
- cd server &&
- git checkout topic2 &&
- # We might have cruft from the previous test
- git reset --hard &&
- echo "commit D continuing topic2" >a.client2 &&
- git add a.client2 &&
- git commit -m "commit D by client2" &&
-
- # E: another client merges stable
- git merge stable &&
-
- # F: another client moves topic2 again
- echo "commit F" >a.client2 &&
- git commit -a -m "commit F by client2" &&
- cd .. &&
-
- # g: now locally try and merge in stable (even though topic2 is out of date)
- git checkout topic2 &&
- git merge stable &&
-
- # h: advance local topic2
- echo "commit H" >a.topic2 &&
- git commit -a -m "commit H continues local fork" &&
-
- # i: make a new merge commit
- git pull &&
- ! git push origin topic2 2>push.err &&
- cat push.err | grep "It looks like you should rebase instead of merging"
-
- # Now fix it
- # git reset --hard ORIG_HEAD &&
- # GIT_EDITOR=: git rebase -i -p origin/topic2 &&
- # git push &&
- # git branch -r --contains stable | grep origin/topic2
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update prefer rebase (with incoming merges)'
+
+. ./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 &&
+ git fetch &&
+
+ # Specifically, setup a stable that we will merge and check for rebase
+ git checkout -b stable master &&
+ echo "setup.stable" >a &&
+ git commit -a -m "stable" &&
+ git push origin stable
+'
+
+install_update_hook 'update-prefer-rebase'
+
+#
+# A -- B <-- origin/stable
+# \ |
+# C -- D <-- origin/topic1
+# \ | \
+# e - f <-- topic1
+#
+# Nope: should rebase e ontop of D
+#
+test_expect_success 'merging in stable does not fool the script' '
+ # start our branch, and share it
+ git checkout -b topic1 stable &&
+ git config --add branch.topic1.remote origin &&
+ git config --add branch.topic1.merge refs/heads/topic1 &&
+ echo "topic1" >a.topic1 &&
+ git add a.topic1 &&
+ git commit -m "topic1" &&
+ git push origin topic1 &&
+
+ # now, separately, move ahead stable, and share it
+ git checkout stable
+ echo "setup.stable.moved" >a &&
+ git commit -a -m "stable moved" &&
+ git push origin stable &&
+
+ # have another client commit (in this case, it is the server, but close enough) move topic1
+ cd server &&
+ git checkout topic1 &&
+ echo "$test_name" >a.client2 &&
+ git add a.client2 &&
+ git commit -m "topic1 changed by client2" &&
+ cd .. &&
+
+ # now locally try and merge in stable (even though topic1 is out of date)
+ git checkout topic1 &&
+ git merge stable &&
+
+ # We are shutdown for being a rewind
+ ! git push 2>push.err &&
+ cat push.err | grep "[rejected] topic1 -> topic1 (non-fast forward)"
+
+ # Make a new merge commit
+ git pull &&
+ ! git push 2>push.err &&
+ cat push.err | grep "It looks like you should rebase instead of merging" &&
+
+ # Now fix it
+ git reset --hard ORIG_HEAD &&
+ GIT_EDITOR=: git rebase -i -p origin/topic1 &&
+ git push &&
+ git branch -r --contains stable | grep origin/topic
+'
+
+#
+# A --C------ <-- origin/stable
+# \ | \
+# B -- D -- E -- F <-- origin/topic2
+# \| \
+# g -- h ------- i <-- topic2
+#
+# Trying to push F..i
+#
+# merge-base(F, h) has two options: B and C
+#
+test_expect_success 'merging in stable with tricky double baserev does not fool the script' '
+ # B: start our branch, and share it
+ git checkout -b topic2 stable &&
+ git config --add branch.topic2.remote origin &&
+ git config --add branch.topic2.merge refs/heads/topic2 &&
+ echo "commit B" >a.topic2 &&
+ git add a.topic2 &&
+ git commit -m "commit B created topic2" &&
+ git push origin topic2 &&
+
+ # C: now, separately, move ahead stable, and share it
+ git checkout stable
+ echo "commit C" >a &&
+ git commit -a -m "commit C moved stable" &&
+ git push origin stable &&
+
+ # D: have another client commit (in this case, it is the server, but close enough) moves topic2
+ cd server &&
+ git checkout topic2 &&
+ # We might have cruft from the previous test
+ git reset --hard &&
+ echo "commit D continuing topic2" >a.client2 &&
+ git add a.client2 &&
+ git commit -m "commit D by client2" &&
+
+ # E: another client merges stable
+ git merge stable &&
+
+ # F: another client moves topic2 again
+ echo "commit F" >a.client2 &&
+ git commit -a -m "commit F by client2" &&
+ cd .. &&
+
+ # g: now locally try and merge in stable (even though topic2 is out of date)
+ git checkout topic2 &&
+ git merge stable &&
+
+ # h: advance local topic2
+ echo "commit H" >a.topic2 &&
+ git commit -a -m "commit H continues local fork" &&
+
+ # i: make a new merge commit
+ git pull &&
+ ! git push origin topic2 2>push.err &&
+ cat push.err | grep "It looks like you should rebase instead of merging"
+
+ # Now fix it
+ # git reset --hard ORIG_HEAD &&
+ # GIT_EDITOR=: git rebase -i -p origin/topic2 &&
+ # git push &&
+ # git branch -r --contains stable | grep origin/topic2
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='rebase interactive does not rebase'
-
-. ./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 &&
- git fetch &&
-
- git checkout -b stable master &&
- echo "setup.stable" >a &&
- git commit -a -m "stable" &&
- git push origin stable
-'
-#
-# A --C------ <-- origin/stable
-# \ | \
-# B -- D -- E -- F <-- origin/topic2
-# \| \
-# g -- h ------- i <-- topic2
-#
-# Trying to push F..i
-#
-# merge-base(F, h) has two options: B and C
-#
-test_expect_success 'merging in stable with tricky double baserev does not fool the script' '
- # B: start our topic2 branch, and share it
- git checkout -b topic2 origin/stable &&
- git config --add branch.topic2.merge refs/heads/topic2 &&
- echo "commit B" >a.topic2 &&
- git add a.topic2 &&
- git commit -m "commit B created topic2" &&
- git push origin topic2 &&
-
- # C: now, separately, move ahead stable, and share it
- git checkout stable
- echo "commit C" >a &&
- git commit -a -m "commit C moved stable" &&
- git push origin stable &&
-
- # D: have another client commit (in this case, it is the server, but close enough) moves topic2
- cd server &&
- git checkout topic2 &&
- echo "commit D continuing topic2" >a.client2 &&
- git add a.client2 &&
- git commit -m "commit D by client2" &&
-
- # E: the same other client merges the moved stable
- git merge stable &&
-
- # F: the same other client moves topic2 again
- echo "commit F" >a.client2 &&
- git commit -a -m "commit F by client2" &&
- F_hash=$(git rev-parse HEAD) &&
- cd .. &&
-
- # g: now locally merge in the moved stable (even though our topic2 is out of date)
- git checkout topic2 &&
- git merge stable &&
- g_hash=$(git rev-parse HEAD) &&
-
- # h: advance local topic2
- echo "commit H" >a.topic2 &&
- git commit -a -m "commit H continues local fork" &&
- h_hash=$(git rev-parse HEAD) &&
-
- # i: make a new merge commit
- git pull --no-rebase &&
- i_hash=$(git rev-parse HEAD) &&
-
- # Watch merge rejected as something that should get rebased
- # ! git push origin topic2
- test "$i_hash $h_hash $F_hash" = "$(git rev-list --parents --no-walk HEAD)"
-
- # Now fix it the merge by rebasing it
- git reset --hard ORIG_HEAD &&
- GIT_EDITOR=: git rebase -i -p origin/topic2 &&
- h2_hash=$(git rev-parse HEAD) &&
-
- # Should be:
- # test "$h2_hash $F_hash" = "$(git rev-list --parents --no-walk HEAD)"
- # But is just:
- test "$h_hash $g_hash" = "$(git rev-list --parents --no-walk HEAD)"
- # Where did $F_hash go?
-'
-
-test_done
-
+++ /dev/null
-#!/bin/sh
-
-test_description='server update prefer rebase'
-
-. ./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 &&
- git fetch
-'
-
-install_update_hook 'update-prefer-rebase'
-
-test_expect_success 'one new, one old parent is okay' '
- # server is on "setup"
-
- # make an outstanding change for us--but do not push
- echo "$test_name" >a.client1 &&
- git add a.client1 &&
- git commit -m "$test_name on client1" &&
-
- # have another client commit (in this case, it is the server, but close enough)
- cd server &&
- echo "$test_name" >a.client2 &&
- git add a.client2 &&
- git commit -m "$test_name on client2" &&
- cd .. &&
-
- # go back to our client and it will merge in our changes
- git pull &&
- merge=$(git rev-parse HEAD) &&
-
- ! git push 2>push.err &&
- cat push.err | grep "It looks like you should rebase instead of merging $merge" &&
- git reset --hard origin/master
-'
-
-test_done
-
-test_expect_success 'all local changes do not need a merge even with more commits after' '
- # server is on "setup"
-
- # make an outstanding change for us--but do not push
- echo "$test_name" >a.client1 &&
- git add a.client1 &&
- git commit -m "$test_name on client1" &&
-
- # have another client commit (in this case, it is the server, but close enough)
- cd server &&
- echo "$test_name" >a.client2 &&
- git add a.client2 &&
- git commit -m "$test_name on client2" &&
-
- # go back to our client and it will merge in our changes
- cd .. &&
- git pull &&
- merge=$(git rev-parse HEAD) &&
-
- # To complicate things, have them add another change
- echo "$test_name again" >a.client1 &&
- git commit -a -m "$test_name on client1 again" &&
-
- ! git push 2>push.err &&
- cat push.err | grep "It looks like you should rebase instead of merging $merge" &&
- git reset --hard origin/master
-'
-
-test_expect_success 'already shared topic changes do warrant a merge' '
- # server is on "setup"
-
- # make a change on topic for us and share it
- git checkout -b topic master &&
- echo "$test_name" >a.client1 &&
- git add a.client1 &&
- git commit -m "$test_name on client1 and topic" &&
- git push origin topic &&
-
- # make an outstanding change that we will have to merge later
- echo "$test_name again" >>a.client1 &&
- git commit -a -m "$test_name on client1 and topic again" &&
-
- # have another client commit to master (in this case, it is the server, but close enough)
- cd server &&
- echo "$test_name" >a.client2 &&
- git add a.client2 &&
- git commit -m "$test_name on client2" &&
-
- # go back to our client and it will merge in our changes
- cd .. &&
- git checkout master &&
- git pull &&
- git merge topic &&
-
- git push
-'
-
-test_expect_success 'simple commit' '
- # go back to topic and make a simple commit/push as a sanity check
- git checkout topic &&
- echo "$test_name" >>a.client1 &&
- git commit -a -m "$test_name on client1 and topic" &&
- git push
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update prefer rebase'
+
+. ./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 &&
+ git fetch
+'
+
+install_update_hook 'update-prefer-rebase'
+
+test_expect_success 'one new, one old parent is okay' '
+ # server is on "setup"
+
+ # make an outstanding change for us--but do not push
+ echo "$test_name" >a.client1 &&
+ git add a.client1 &&
+ git commit -m "$test_name on client1" &&
+
+ # have another client commit (in this case, it is the server, but close enough)
+ cd server &&
+ echo "$test_name" >a.client2 &&
+ git add a.client2 &&
+ git commit -m "$test_name on client2" &&
+ cd .. &&
+
+ # go back to our client and it will merge in our changes
+ git pull &&
+ merge=$(git rev-parse HEAD) &&
+
+ ! git push 2>push.err &&
+ cat push.err | grep "It looks like you should rebase instead of merging $merge" &&
+ git reset --hard origin/master
+'
+
+test_done
+
+test_expect_success 'all local changes do not need a merge even with more commits after' '
+ # server is on "setup"
+
+ # make an outstanding change for us--but do not push
+ echo "$test_name" >a.client1 &&
+ git add a.client1 &&
+ git commit -m "$test_name on client1" &&
+
+ # have another client commit (in this case, it is the server, but close enough)
+ cd server &&
+ echo "$test_name" >a.client2 &&
+ git add a.client2 &&
+ git commit -m "$test_name on client2" &&
+
+ # go back to our client and it will merge in our changes
+ cd .. &&
+ git pull &&
+ merge=$(git rev-parse HEAD) &&
+
+ # To complicate things, have them add another change
+ echo "$test_name again" >a.client1 &&
+ git commit -a -m "$test_name on client1 again" &&
+
+ ! git push 2>push.err &&
+ cat push.err | grep "It looks like you should rebase instead of merging $merge" &&
+ git reset --hard origin/master
+'
+
+test_expect_success 'already shared topic changes do warrant a merge' '
+ # server is on "setup"
+
+ # make a change on topic for us and share it
+ git checkout -b topic master &&
+ echo "$test_name" >a.client1 &&
+ git add a.client1 &&
+ git commit -m "$test_name on client1 and topic" &&
+ git push origin topic &&
+
+ # make an outstanding change that we will have to merge later
+ echo "$test_name again" >>a.client1 &&
+ git commit -a -m "$test_name on client1 and topic again" &&
+
+ # have another client commit to master (in this case, it is the server, but close enough)
+ cd server &&
+ echo "$test_name" >a.client2 &&
+ git add a.client2 &&
+ git commit -m "$test_name on client2" &&
+
+ # go back to our client and it will merge in our changes
+ cd .. &&
+ git checkout master &&
+ git pull &&
+ git merge topic &&
+
+ git push
+'
+
+test_expect_success 'simple commit' '
+ # go back to topic and make a simple commit/push as a sanity check
+ git checkout topic &&
+ echo "$test_name" >>a.client1 &&
+ git commit -a -m "$test_name on client1 and topic" &&
+ git push
+'
+
+test_done
+
--- /dev/null
+#!/bin/sh
+
+test_description='server pre-receive only one branch/push'
+
+. ./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 &&
+ git fetch
+'
+
+install_server_hook 'pre-receive-only-one' 'pre-receive'
+
+test_expect_success 'pushing just topic is okay' '
+ git checkout -b topic &&
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name on topic" &&
+ git push origin topic
+'
+
+test_expect_success 'pushing just master is okay' '
+ git checkout master &&
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name on master" &&
+ git push
+'
+
+test_expect_success 'pushing both master and topic fails' '
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name on master" &&
+
+ git checkout topic &&
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name on topic" &&
+
+ ! git push 2>push.err &&
+ cat push.err | grep "Only push one branch at a time"
+'
+
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server pre-receive only one branch/push'
-
-. ./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 &&
- git fetch
-'
-
-install_server_hook 'pre-receive-only-one' 'pre-receive'
-
-test_expect_success 'pushing just topic is okay' '
- git checkout -b topic &&
- echo "$test_name" >a &&
- git commit -a -m "$test_name on topic" &&
- git push origin topic
-'
-
-test_expect_success 'pushing just master is okay' '
- git checkout master &&
- echo "$test_name" >a &&
- git commit -a -m "$test_name on master" &&
- git push
-'
-
-test_expect_success 'pushing both master and topic fails' '
- echo "$test_name" >a &&
- git commit -a -m "$test_name on master" &&
-
- git checkout topic &&
- echo "$test_name" >a &&
- git commit -a -m "$test_name on topic" &&
-
- ! git push 2>push.err &&
- cat push.err | grep "Only push one branch at a time"
-'
-
-
-test_done
-
+++ /dev/null
-#!/bin/sh
-
-test_description='server update ensure merged'
-
-. ./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 &&
- git fetch &&
- git checkout -b stable &&
- git push origin stable
-'
-
-install_server_hook 'update-ensure-merged' 'update'
-
-test_expect_success 'pushing just topic is okay' '
- git checkout -b topic &&
- echo "$test_name" >a &&
- git commit -a -m "$test_name on topic" &&
- git push origin topic
-'
-
-test_expect_failure 'if topic moves on, tagging candidate requires a merge' '
- git checkout -b candidate stable &&
- git merge topic --no-ff &&
- git push &&
-
- git checkout topic &&
- echo "$test_name on topic" >a &&
- git commit -a -m "$test_name on topic" &&
- git push &&
-
- git checkout candidate &&
- git tag -a -m "Tagging candidate" deployment-1 &&
- ! git push --tags 2>push.err &&
- cat push.err | grep "Rejecting refs/tags/deployment-1 because you need to merge" &&
- cat push.err | grep "topic" &&
-
- git merge topic &&
- git tag -d deployment-1 &&
- git tag -a -m "Tagging candidate" deployment-1 &&
- git push --tags
-'
-
-test_expect_success 'if stable moves on, tagging candidate requires a merge' '
- git checkout stable &&
- echo "$test_name on stable" >a.stable &&
- git add a.stable &&
- git commit -a -m "$test_name on stable" &&
- git push &&
-
- git checkout candidate &&
- git tag -a -m "Tagging candidate" deployment-2 &&
- ! git push --tags 2>push.err &&
- cat push.err | grep "Rejecting refs/tags/deployment-2 because you need to merge" &&
- cat push.err | grep "stable" &&
-
- git merge stable &&
- git tag -d deployment-2 &&
- git tag -a -m "Tagging candidate" deployment-2 &&
- git push --tags
-'
-
-test_expect_failure 'when creating a candidate, it must be a merge' '
- git checkout -b topic2 stable &&
- echo "$test_name on topic2" >a &&
- git commit -a -m "$test_name on topic2" &&
- git push origin topic2 &&
-
- git checkout -b candidate2 stable &&
- git merge topic2 &&
- ! git push origin candidate2 2>push.err &&
- cat push.err | grep "Candidate branches must be only merges" &&
-
- git reset --hard HEAD^ &&
- git merge --no-ff topic2 &&
- git push origin candidate2
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update ensure merged'
+
+. ./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 &&
+ git fetch &&
+ git checkout -b stable &&
+ git push origin stable
+'
+
+install_server_hook 'update-ensure-merged' 'update'
+
+test_expect_success 'pushing just topic is okay' '
+ git checkout -b topic &&
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name on topic" &&
+ git push origin topic
+'
+
+test_expect_failure 'if topic moves on, tagging candidate requires a merge' '
+ git checkout -b candidate stable &&
+ git merge topic --no-ff &&
+ git push &&
+
+ git checkout topic &&
+ echo "$test_name on topic" >a &&
+ git commit -a -m "$test_name on topic" &&
+ git push &&
+
+ git checkout candidate &&
+ git tag -a -m "Tagging candidate" deployment-1 &&
+ ! git push --tags 2>push.err &&
+ cat push.err | grep "Rejecting refs/tags/deployment-1 because you need to merge" &&
+ cat push.err | grep "topic" &&
+
+ git merge topic &&
+ git tag -d deployment-1 &&
+ git tag -a -m "Tagging candidate" deployment-1 &&
+ git push --tags
+'
+
+test_expect_success 'if stable moves on, tagging candidate requires a merge' '
+ git checkout stable &&
+ echo "$test_name on stable" >a.stable &&
+ git add a.stable &&
+ git commit -a -m "$test_name on stable" &&
+ git push &&
+
+ git checkout candidate &&
+ git tag -a -m "Tagging candidate" deployment-2 &&
+ ! git push --tags 2>push.err &&
+ cat push.err | grep "Rejecting refs/tags/deployment-2 because you need to merge" &&
+ cat push.err | grep "stable" &&
+
+ git merge stable &&
+ git tag -d deployment-2 &&
+ git tag -a -m "Tagging candidate" deployment-2 &&
+ git push --tags
+'
+
+test_expect_failure 'when creating a candidate, it must be a merge' '
+ git checkout -b topic2 stable &&
+ echo "$test_name on topic2" >a &&
+ git commit -a -m "$test_name on topic2" &&
+ git push origin topic2 &&
+
+ git checkout -b candidate2 stable &&
+ git merge topic2 &&
+ ! git push origin candidate2 2>push.err &&
+ cat push.err | grep "Candidate branches must be only merges" &&
+
+ git reset --hard HEAD^ &&
+ git merge --no-ff topic2 &&
+ git push origin candidate2
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update prefer underscores in branch names'
-
-. ./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 &&
- git fetch &&
- git checkout -b stable &&
- git push origin stable
-'
-
-install_update_hook 'update-prefer-underscores'
-
-test_expect_success 'pushing topic_topic works' '
- git checkout -b topic_topic &&
- echo "$test_name" >a &&
- git commit -a -m "$test_name on topic_topic" &&
- git push origin topic_topic
-'
-
-test_expect_success 'pushing topicTopic fails' '
- git checkout -b topicTopic &&
- echo "$test_name" >a &&
- git commit -a -m "$test_name on topicTopic" &&
- ! git push origin topicTopic 2>push.err &&
- cat push.err | grep "Please use underscored branch names"
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update prefer underscores in branch names'
+
+. ./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 &&
+ git fetch &&
+ git checkout -b stable &&
+ git push origin stable
+'
+
+install_update_hook 'update-prefer-underscores'
+
+test_expect_success 'pushing topic_topic works' '
+ git checkout -b topic_topic &&
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name on topic_topic" &&
+ git push origin topic_topic
+'
+
+test_expect_success 'pushing topicTopic fails' '
+ git checkout -b topicTopic &&
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name on topicTopic" &&
+ ! git push origin topicTopic 2>push.err &&
+ cat push.err | grep "Please use underscored branch names"
+'
+
+test_done
+
--- /dev/null
+#!/bin/sh
+
+test_description='server update ensure follows'
+
+. ./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 fetch
+'
+
+install_update_hook 'update-ensure-follows'
+
+test_expect_success 'pushing stable works' '
+ git checkout -b stable &&
+ git push origin stable
+'
+
+test_expect_success 'branch with unmoved stable is okay' '
+ cd server &&
+ git config hooks.update-ensure-follows.branches stable &&
+ cd .. &&
+
+ git checkout -b topic1 &&
+ echo "$test_name" >a.topic1 &&
+ git add a.topic1 &&
+ git commit -m "Add on topic1." &&
+ git push origin topic1
+'
+
+test_expect_success 'branch with moved stable requires merge' '
+ git checkout stable &&
+ echo "$test_name" >a &&
+ git commit -a -m "Change on stable" &&
+ git push origin stable &&
+
+ git checkout topic1 &&
+ echo "$test_name" >a.topic1 &&
+ git commit -a -m "Change on topic1." &&
+ ! git push origin topic1 2>push.err &&
+ cat push.err | grep "You need to merge stable into topic1" &&
+
+ git merge stable &&
+ git push origin topic1
+'
+
+test_expect_success 'branch with moved stable is told to update first' '
+ git checkout stable &&
+ echo "$test_name" >a &&
+ git commit -a -m "Change on stable" &&
+ git push origin stable &&
+
+ # Someone fixes stable first
+ cd server &&
+ git checkout -f topic1 &&
+ git merge stable &&
+ cd .. &&
+
+ git checkout topic1 &&
+ echo "$test_name" >a.topic1 &&
+ git commit -a -m "Change on topic1." &&
+ ! git push --force origin topic1 2>push.err &&
+ cat push.err | grep "You need to update your local branch topic1" &&
+
+ # Now it will work as the teammate merged for us
+ git pull origin topic1 &&
+ git push origin topic1
+'
+
+test_expect_success 'branch with moved stable as second branch requires merge' '
+ cd server &&
+ git config hooks.update-ensure-follows.branches "foo stable" &&
+ cd .. &&
+
+ git checkout stable &&
+ echo "$test_name" >a &&
+ git commit -a -m "Change on stable" &&
+ git push origin stable &&
+
+ git checkout topic1 &&
+ echo "$test_name" >a.topic1 &&
+ git commit -a -m "Change on topic1." &&
+ ! git push origin topic1 2>push.err &&
+ cat push.err | grep "You need to merge stable into topic1" &&
+
+ git merge stable &&
+ git push origin topic1
+'
+
+test_expect_success 'tag with moved stable is okay' '
+ git checkout stable &&
+ echo "$test_name" >a &&
+ git commit -a -m "Change on stable" &&
+ git push origin stable &&
+
+ git checkout topic1 &&
+ git tag topic1-tag1
+ git push --tags
+'
+
+test_expect_success 'branch deletion with moved stable is okay' '
+ git checkout stable &&
+ echo "$test_name" >a &&
+ git commit -a -m "Change on stable" &&
+
+ git push origin :topic1
+'
+
+test_expect_success 'excused branch with moved stable is okay' '
+ git checkout -b topic2 stable &&
+ echo "$test_name" >a.topic2 &&
+ git add a.topic2 &&
+ git commit -m "Change on topic2" &&
+ git push origin topic2 &&
+
+ git checkout stable &&
+ echo "$test_name" >a &&
+ git commit -a -m "Change on stable" &&
+ git push origin stable &&
+
+ git checkout topic2 &&
+ echo "$test_name foo" >a.topic2 &&
+ git commit -a -m "Change on topic2 again" &&
+ ! git push origin topic2 &&
+
+ cd server &&
+ git config hooks.update-ensure-follows.excused topic2 &&
+ cd .. &&
+
+ git push origin topic2
+'
+
+test_expect_success 'new branch without stable gets nicer error' '
+ git checkout -b topic3 stable &&
+ echo "$test_name" >a.topic3 &&
+ git add a.topic3 &&
+ git commit -m "Change on topic3" &&
+
+ git checkout stable &&
+ echo "$test_name" >a &&
+ git commit -a -m "Change on stable" &&
+ git push origin stable &&
+
+ git checkout topic3 &&
+ ! git push origin topic3 2>push.err &&
+ grep "You need to merge stable into topic3" push.err &&
+
+ git merge stable &&
+ git push origin topic3
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update ensure follows'
-
-. ./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 fetch
-'
-
-install_update_hook 'update-ensure-follows'
-
-test_expect_success 'pushing stable works' '
- git checkout -b stable &&
- git push origin stable
-'
-
-test_expect_success 'branch with unmoved stable is okay' '
- cd server &&
- git config hooks.update-ensure-follows.branches stable &&
- cd .. &&
-
- git checkout -b topic1 &&
- echo "$test_name" >a.topic1 &&
- git add a.topic1 &&
- git commit -m "Add on topic1." &&
- git push origin topic1
-'
-
-test_expect_success 'branch with moved stable requires merge' '
- git checkout stable &&
- echo "$test_name" >a &&
- git commit -a -m "Change on stable" &&
- git push origin stable &&
-
- git checkout topic1 &&
- echo "$test_name" >a.topic1 &&
- git commit -a -m "Change on topic1." &&
- ! git push origin topic1 2>push.err &&
- cat push.err | grep "You need to merge stable into topic1" &&
-
- git merge stable &&
- git push origin topic1
-'
-
-test_expect_success 'branch with moved stable is told to update first' '
- git checkout stable &&
- echo "$test_name" >a &&
- git commit -a -m "Change on stable" &&
- git push origin stable &&
-
- # Someone fixes stable first
- cd server &&
- git checkout -f topic1 &&
- git merge stable &&
- cd .. &&
-
- git checkout topic1 &&
- echo "$test_name" >a.topic1 &&
- git commit -a -m "Change on topic1." &&
- ! git push --force origin topic1 2>push.err &&
- cat push.err | grep "You need to update your local branch topic1" &&
-
- # Now it will work as the teammate merged for us
- git pull origin topic1 &&
- git push origin topic1
-'
-
-test_expect_success 'branch with moved stable as second branch requires merge' '
- cd server &&
- git config hooks.update-ensure-follows.branches "foo stable" &&
- cd .. &&
-
- git checkout stable &&
- echo "$test_name" >a &&
- git commit -a -m "Change on stable" &&
- git push origin stable &&
-
- git checkout topic1 &&
- echo "$test_name" >a.topic1 &&
- git commit -a -m "Change on topic1." &&
- ! git push origin topic1 2>push.err &&
- cat push.err | grep "You need to merge stable into topic1" &&
-
- git merge stable &&
- git push origin topic1
-'
-
-test_expect_success 'tag with moved stable is okay' '
- git checkout stable &&
- echo "$test_name" >a &&
- git commit -a -m "Change on stable" &&
- git push origin stable &&
-
- git checkout topic1 &&
- git tag topic1-tag1
- git push --tags
-'
-
-test_expect_success 'branch deletion with moved stable is okay' '
- git checkout stable &&
- echo "$test_name" >a &&
- git commit -a -m "Change on stable" &&
-
- git push origin :topic1
-'
-
-test_expect_success 'excused branch with moved stable is okay' '
- git checkout -b topic2 stable &&
- echo "$test_name" >a.topic2 &&
- git add a.topic2 &&
- git commit -m "Change on topic2" &&
- git push origin topic2 &&
-
- git checkout stable &&
- echo "$test_name" >a &&
- git commit -a -m "Change on stable" &&
- git push origin stable &&
-
- git checkout topic2 &&
- echo "$test_name foo" >a.topic2 &&
- git commit -a -m "Change on topic2 again" &&
- ! git push origin topic2 &&
-
- cd server &&
- git config hooks.update-ensure-follows.excused topic2 &&
- cd .. &&
-
- git push origin topic2
-'
-
-test_expect_success 'new branch without stable gets nicer error' '
- git checkout -b topic3 stable &&
- echo "$test_name" >a.topic3 &&
- git add a.topic3 &&
- git commit -m "Change on topic3" &&
-
- git checkout stable &&
- echo "$test_name" >a &&
- git commit -a -m "Change on stable" &&
- git push origin stable &&
-
- git checkout topic3 &&
- ! git push origin topic3 2>push.err &&
- grep "You need to merge stable into topic3" push.err &&
-
- git merge stable &&
- git push origin topic3
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update git config'
+
+. ./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 &&
+ git fetch
+'
+
+install_post_receive_hook 'post-receive-git-config'
+
+test_expect_success 'pushing initial value works' '
+ cd server &&
+ ! git config --list | grep foo &&
+ cd .. &&
+
+ ../../scripts/make-gitconfig-branch &&
+ git checkout gitconfig &&
+ echo "foo.foo=bar" > config &&
+ git commit -a -m "Set foo.foo=bar."
+ git push origin gitconfig
+
+ cd server &&
+ git config --list | grep foo &&
+ cd ..
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update git config'
-
-. ./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 &&
- git fetch
-'
-
-install_post_receive_hook 'post-receive-git-config'
-
-test_expect_success 'pushing initial value works' '
- cd server &&
- ! git config --list | grep foo &&
- cd .. &&
-
- ../../scripts/make-gitconfig-branch &&
- git checkout gitconfig &&
- echo "foo.foo=bar" > config &&
- git commit -a -m "Set foo.foo=bar."
- git push origin gitconfig
-
- cd server &&
- git config --list | grep foo &&
- cd ..
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update git config'
+
+. ./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
+'
+
+install_post_receive_hook 'post-receive-git-config'
+
+test_expect_success 'adding hook' '
+ ls server/.git/hooks | grep post-receive &&
+ ../../scripts/make-gitconfig-branch &&
+ git checkout gitconfig &&
+
+ mkdir hooks &&
+ cd hooks &&
+ echo "#!/bin/sh" > post-receive &&
+ echo "../../../../server/post-receive-git-config" >> post-receive &&
+ echo "echo barbar" >> post-receive &&
+ echo "#!/bin/sh" > update &&
+ echo "echo foofoo" >> update &&
+ git add post-receive &&
+ git add update &&
+ git commit -m "added post-receive and update" &&
+ git push origin gitconfig &&
+ cd .. &&
+
+ cat server/.git/hooks/post-receive | grep barbar &&
+ cat server/.git/hooks/update | grep foofoo
+'
+
+test_expect_success 'changing hook' '
+ echo "#!/bin/sh" > hooks/update &&
+ echo "echo lala" >> hooks/update &&
+ git commit -a -m "changed update" &&
+ git push origin gitconfig &&
+
+ cat server/.git/hooks/post-receive | grep barbar &&
+ ! cat server/.git/hooks/update | grep barbar &&
+ cat server/.git/hooks/update | grep lala
+'
+
+test_expect_success 'removing hook does not work' '
+ git rm hooks/update &&
+ git commit -m "removed update" &&
+ git push origin gitconfig &&
+
+ ls server/.git/hooks | grep post-receive
+ ls server/.git/hooks | grep update
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update git config'
-
-. ./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
-'
-
-install_post_receive_hook 'post-receive-git-config'
-
-test_expect_success 'adding hook' '
- ls server/.git/hooks | grep post-receive &&
- ../../scripts/make-gitconfig-branch &&
- git checkout gitconfig &&
-
- mkdir hooks &&
- cd hooks &&
- echo "#!/bin/sh" > post-receive &&
- echo "../../../../server/post-receive-git-config" >> post-receive &&
- echo "echo barbar" >> post-receive &&
- echo "#!/bin/sh" > update &&
- echo "echo foofoo" >> update &&
- git add post-receive &&
- git add update &&
- git commit -m "added post-receive and update" &&
- git push origin gitconfig &&
- cd .. &&
-
- cat server/.git/hooks/post-receive | grep barbar &&
- cat server/.git/hooks/update | grep foofoo
-'
-
-test_expect_success 'changing hook' '
- echo "#!/bin/sh" > hooks/update &&
- echo "echo lala" >> hooks/update &&
- git commit -a -m "changed update" &&
- git push origin gitconfig &&
-
- cat server/.git/hooks/post-receive | grep barbar &&
- ! cat server/.git/hooks/update | grep barbar &&
- cat server/.git/hooks/update | grep lala
-'
-
-test_expect_success 'removing hook does not work' '
- git rm hooks/update &&
- git commit -m "removed update" &&
- git push origin gitconfig &&
-
- ls server/.git/hooks | grep post-receive
- ls server/.git/hooks | grep update
-'
-
-test_done
-
+++ /dev/null
-#!/bin/sh
-
-test_description='server update lock check'
-
-. ./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 &&
- git fetch
-'
-
-install_update_hook 'update-lock-check.rb'
-
-test_expect_success 'locked branch is rejected' '
- cd server &&
- git config hooks.update-lock-check.locked master &&
- cd .. &&
-
- echo "$test_name" >a &&
- git commit -a -m "changed" &&
- ! git push 2>push.err &&
- cat push.err | grep "Branch master is locked"
-'
-
-test_expect_success 'locked branch is rejected with multiple branches set' '
- cd server &&
- git config hooks.update-lock-check.locked "foo bar master" &&
- cd .. &&
-
- echo "$test_name" >a &&
- git commit -a -m "changed" &&
- ! git push 2>push.err &&
- cat push.err | grep "Branch master is locked"
-'
-
-test_expect_success 'preserved branch cannot be deleted' '
- cd server &&
- git config hooks.update-lock-check.locked "" &&
- git config hooks.update-lock-check.preserved master &&
- cd .. &&
-
- ! git push origin :master 2>push.err &&
- cat push.err | grep "Branch master cannot be deleted"
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update lock check'
+
+. ./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 &&
+ git fetch
+'
+
+install_update_hook 'update-lock-check.rb'
+
+test_expect_success 'locked branch is rejected' '
+ cd server &&
+ git config hooks.update-lock-check.locked master &&
+ cd .. &&
+
+ echo "$test_name" >a &&
+ git commit -a -m "changed" &&
+ ! git push 2>push.err &&
+ cat push.err | grep "Branch master is locked"
+'
+
+test_expect_success 'locked branch is rejected with multiple branches set' '
+ cd server &&
+ git config hooks.update-lock-check.locked "foo bar master" &&
+ cd .. &&
+
+ echo "$test_name" >a &&
+ git commit -a -m "changed" &&
+ ! git push 2>push.err &&
+ cat push.err | grep "Branch master is locked"
+'
+
+test_expect_success 'preserved branch cannot be deleted' '
+ cd server &&
+ git config hooks.update-lock-check.locked "" &&
+ git config hooks.update-lock-check.preserved master &&
+ cd .. &&
+
+ ! git push origin :master 2>push.err &&
+ cat push.err | grep "Branch master cannot be deleted"
+'
+
+test_done
+
--- /dev/null
+#!/bin/sh
+
+test_description='server update lock check'
+
+. ./test-lib.sh
+
+export PYTHON=echo
+export TRAC_ENV=/foo/trac
+
+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
+'
+
+install_post_receive_hook 'post-receive-trac'
+
+test_expect_success 'new branch' '
+ git checkout -b topic1 master &&
+ echo "$test_name" >a &&
+ git commit -a -m "changed on topic1" &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ git push origin topic1 2>push.err &&
+ cat push.err | grep "/foo/trac topic1 $new_commit_hash $new_commit_hash $new_commit_hash"
+'
+
+test_expect_success 'new branch with already existing does not double tap' '
+ git checkout -b topic2 topic1 &&
+ existing_commit_hash=$(git rev-parse HEAD) &&
+ git push origin topic2 2>push.err &&
+ ! cat push.err | grep "/foo/trac topic2"
+'
+
+test_expect_success 'update branch' '
+ # Already on topic2
+ echo "$test_name" >a &&
+ git commit -a -m "changed on topic2" &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ git push origin topic2 2>push.err &&
+ cat push.err | grep "/foo/trac topic2 $new_commit_hash $new_commit_hash $new_commit_hash"
+'
+
+test_expect_success 'update branch to an already published commit does not double tap' '
+ # Make topic1 catch up to topic2, which will be a fast forward that does need re-tapped
+ git checkout topic2 &&
+ topic2_hash=$(git rev-parse HEAD) &&
+
+ git checkout topic1 &&
+ git merge topic2 &&
+ topic1_hash=$(git rev-parse HEAD) &&
+
+ git push 2>push.err &&
+
+ ! cat push.err | grep "/foo/trac topic2"
+ ! cat push.err | grep "/foo/trac topic1"
+'
+
+test_expect_success 'update branch with abbreviation' '
+ git checkout topic2
+ git tag -m "release1" release1 &&
+ git push --tags &&
+
+ echo "$test_name" >a &&
+ git commit -a -m "changed on topic2" &&
+ new_commit_describe=$(git describe HEAD) &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ git push origin topic2 2>push.err &&
+ cat push.err | grep "/foo/trac topic2 $new_commit_describe $new_commit_describe $new_commit_hash"
+'
+
+test_expect_success 'update branch with abbreviation and two commits' '
+ echo "$test_name 1" >a &&
+ git commit -a -m "changed on topic2 1" &&
+ first_commit_describe=$(git describe HEAD) &&
+ first_commit_hash=$(git rev-parse HEAD) &&
+
+ echo "$test_name 2" >a &&
+ git commit -a -m "changed on topic2 2" &&
+ second_commit_describe=$(git describe HEAD) &&
+ second_commit_hash=$(git rev-parse HEAD) &&
+
+ git push origin topic2 2>push.err &&
+ cat push.err | grep "/foo/trac topic2 $first_commit_describe $first_commit_describe $first_commit_hash" &&
+ cat push.err | grep "/foo/trac topic2 $second_commit_describe $second_commit_describe $second_commit_hash"
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update lock check'
-
-. ./test-lib.sh
-
-export PYTHON=echo
-export TRAC_ENV=/foo/trac
-
-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
-'
-
-install_post_receive_hook 'post-receive-trac'
-
-test_expect_success 'new branch' '
- git checkout -b topic1 master &&
- echo "$test_name" >a &&
- git commit -a -m "changed on topic1" &&
- new_commit_hash=$(git rev-parse HEAD) &&
- git push origin topic1 2>push.err &&
- cat push.err | grep "/foo/trac topic1 $new_commit_hash $new_commit_hash $new_commit_hash"
-'
-
-test_expect_success 'new branch with already existing does not double tap' '
- git checkout -b topic2 topic1 &&
- existing_commit_hash=$(git rev-parse HEAD) &&
- git push origin topic2 2>push.err &&
- ! cat push.err | grep "/foo/trac topic2"
-'
-
-test_expect_success 'update branch' '
- # Already on topic2
- echo "$test_name" >a &&
- git commit -a -m "changed on topic2" &&
- new_commit_hash=$(git rev-parse HEAD) &&
- git push origin topic2 2>push.err &&
- cat push.err | grep "/foo/trac topic2 $new_commit_hash $new_commit_hash $new_commit_hash"
-'
-
-test_expect_success 'update branch to an already published commit does not double tap' '
- # Make topic1 catch up to topic2, which will be a fast forward that does need re-tapped
- git checkout topic2 &&
- topic2_hash=$(git rev-parse HEAD) &&
-
- git checkout topic1 &&
- git merge topic2 &&
- topic1_hash=$(git rev-parse HEAD) &&
-
- git push 2>push.err &&
-
- ! cat push.err | grep "/foo/trac topic2"
- ! cat push.err | grep "/foo/trac topic1"
-'
-
-test_expect_success 'update branch with abbreviation' '
- git checkout topic2
- git tag -m "release1" release1 &&
- git push --tags &&
-
- echo "$test_name" >a &&
- git commit -a -m "changed on topic2" &&
- new_commit_describe=$(git describe HEAD) &&
- new_commit_hash=$(git rev-parse HEAD) &&
- git push origin topic2 2>push.err &&
- cat push.err | grep "/foo/trac topic2 $new_commit_describe $new_commit_describe $new_commit_hash"
-'
-
-test_expect_success 'update branch with abbreviation and two commits' '
- echo "$test_name 1" >a &&
- git commit -a -m "changed on topic2 1" &&
- first_commit_describe=$(git describe HEAD) &&
- first_commit_hash=$(git rev-parse HEAD) &&
-
- echo "$test_name 2" >a &&
- git commit -a -m "changed on topic2 2" &&
- second_commit_describe=$(git describe HEAD) &&
- second_commit_hash=$(git rev-parse HEAD) &&
-
- git push origin topic2 2>push.err &&
- cat push.err | grep "/foo/trac topic2 $first_commit_describe $first_commit_describe $first_commit_hash" &&
- cat push.err | grep "/foo/trac topic2 $second_commit_describe $second_commit_describe $second_commit_hash"
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server post receive trac with commit numbers'
+
+. ./test-lib.sh
+
+export PYTHON=echo
+export TRAC_ENV=/foo/trac
+
+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
+'
+
+install_post_receive_hook 'post-receive-assign-commit-numbers' 'post-receive-trac'
+
+test_expect_success 'new branch' '
+ git checkout -b topic1 master &&
+ echo "$test_name" >a &&
+ git commit -a -m "changed on topic1" &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ git push origin topic1 2>push.err &&
+ cat push.err | grep "/foo/trac topic1 $new_commit_hash r/1 $new_commit_hash"
+'
+
+test_expect_success 'new branch with already existing does not double tap' '
+ git checkout -b topic2 topic1 &&
+ existing_commit_hash=$(git rev-parse HEAD) &&
+ git push origin topic2 2>push.err &&
+ ! cat push.err | grep "/foo/trac topic2"
+'
+
+test_expect_success 'update branch' '
+ # Already on topic2
+ echo "$test_name" >a &&
+ git commit -a -m "changed on topic2" &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ git push origin topic2 2>push.err &&
+ cat push.err | grep "/foo/trac topic2 $new_commit_hash r/2 $new_commit_hash"
+'
+
+test_expect_success 'update branch to an already published commit does not double tap' '
+ # Make topic1 catch up to topic2, which will be a fast forward that does need re-tapped
+ git checkout topic2 &&
+ topic2_hash=$(git rev-parse HEAD) &&
+
+ git checkout topic1 &&
+ git merge topic2 &&
+ topic1_hash=$(git rev-parse HEAD) &&
+
+ git push 2>push.err &&
+
+ ! cat push.err | grep "/foo/trac topic2"
+ ! cat push.err | grep "/foo/trac topic1"
+'
+
+test_expect_success 'update branch with abbreviation' '
+ git checkout topic2
+ git tag -m "release1" release1 &&
+ git push --tags &&
+
+ echo "$test_name" >a &&
+ git commit -a -m "changed on topic2" &&
+ new_commit_describe=$(git describe HEAD) &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ git push origin topic2 2>push.err &&
+ cat push.err | grep "/foo/trac topic2 $new_commit_describe r/3 $new_commit_hash"
+'
+
+test_expect_success 'update branch with abbreviation and two commits' '
+ echo "$test_name 1" >a &&
+ git commit -a -m "changed on topic2 1" &&
+ first_commit_describe=$(git describe HEAD) &&
+ first_commit_hash=$(git rev-parse HEAD) &&
+
+ echo "$test_name 2" >a &&
+ git commit -a -m "changed on topic2 2" &&
+ second_commit_describe=$(git describe HEAD) &&
+ second_commit_hash=$(git rev-parse HEAD) &&
+
+ git push origin topic2 2>push.err &&
+ cat push.err | grep "/foo/trac topic2 $first_commit_describe r/4 $first_commit_hash" &&
+ cat push.err | grep "/foo/trac topic2 $second_commit_describe r/5 $second_commit_hash"
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server post receive trac with commit numbers'
-
-. ./test-lib.sh
-
-export PYTHON=echo
-export TRAC_ENV=/foo/trac
-
-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
-'
-
-install_post_receive_hook 'post-receive-assign-commit-numbers' 'post-receive-trac'
-
-test_expect_success 'new branch' '
- git checkout -b topic1 master &&
- echo "$test_name" >a &&
- git commit -a -m "changed on topic1" &&
- new_commit_hash=$(git rev-parse HEAD) &&
- git push origin topic1 2>push.err &&
- cat push.err | grep "/foo/trac topic1 $new_commit_hash r/1 $new_commit_hash"
-'
-
-test_expect_success 'new branch with already existing does not double tap' '
- git checkout -b topic2 topic1 &&
- existing_commit_hash=$(git rev-parse HEAD) &&
- git push origin topic2 2>push.err &&
- ! cat push.err | grep "/foo/trac topic2"
-'
-
-test_expect_success 'update branch' '
- # Already on topic2
- echo "$test_name" >a &&
- git commit -a -m "changed on topic2" &&
- new_commit_hash=$(git rev-parse HEAD) &&
- git push origin topic2 2>push.err &&
- cat push.err | grep "/foo/trac topic2 $new_commit_hash r/2 $new_commit_hash"
-'
-
-test_expect_success 'update branch to an already published commit does not double tap' '
- # Make topic1 catch up to topic2, which will be a fast forward that does need re-tapped
- git checkout topic2 &&
- topic2_hash=$(git rev-parse HEAD) &&
-
- git checkout topic1 &&
- git merge topic2 &&
- topic1_hash=$(git rev-parse HEAD) &&
-
- git push 2>push.err &&
-
- ! cat push.err | grep "/foo/trac topic2"
- ! cat push.err | grep "/foo/trac topic1"
-'
-
-test_expect_success 'update branch with abbreviation' '
- git checkout topic2
- git tag -m "release1" release1 &&
- git push --tags &&
-
- echo "$test_name" >a &&
- git commit -a -m "changed on topic2" &&
- new_commit_describe=$(git describe HEAD) &&
- new_commit_hash=$(git rev-parse HEAD) &&
- git push origin topic2 2>push.err &&
- cat push.err | grep "/foo/trac topic2 $new_commit_describe r/3 $new_commit_hash"
-'
-
-test_expect_success 'update branch with abbreviation and two commits' '
- echo "$test_name 1" >a &&
- git commit -a -m "changed on topic2 1" &&
- first_commit_describe=$(git describe HEAD) &&
- first_commit_hash=$(git rev-parse HEAD) &&
-
- echo "$test_name 2" >a &&
- git commit -a -m "changed on topic2 2" &&
- second_commit_describe=$(git describe HEAD) &&
- second_commit_hash=$(git rev-parse HEAD) &&
-
- git push origin topic2 2>push.err &&
- cat push.err | grep "/foo/trac topic2 $first_commit_describe r/4 $first_commit_hash" &&
- cat push.err | grep "/foo/trac topic2 $second_commit_describe r/5 $second_commit_hash"
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update tags in branch check'
+
+. ./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
+'
+
+install_update_hook 'update-ensure-tag-in-branch'
+
+test_expect_success 'push only tag fails' '
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name moved master" &&
+ git tag -a -m "tagged move as r1" r1 &&
+ ! git push --tags 2>push.err &&
+ cat push.err | grep "The tag r1 is not included in any branch." &&
+
+ # But now it works if we push the commit first
+ git push &&
+ git push --tags
+'
+
+test_expect_success 'push works if done at the same time' '
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name moved master" &&
+ git tag -a -m "tagged move as r2" r2 &&
+ git push origin master r2
+'
+
+test_expect_success 'moving branch back and deleting tag works' '
+ git reset --hard HEAD^ &&
+ git push --force origin master:master :r2
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update tags in branch check'
-
-. ./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
-'
-
-install_update_hook 'update-ensure-tag-in-branch'
-
-test_expect_success 'push only tag fails' '
- echo "$test_name" >a &&
- git commit -a -m "$test_name moved master" &&
- git tag -a -m "tagged move as r1" r1 &&
- ! git push --tags 2>push.err &&
- cat push.err | grep "The tag r1 is not included in any branch." &&
-
- # But now it works if we push the commit first
- git push &&
- git push --tags
-'
-
-test_expect_success 'push works if done at the same time' '
- echo "$test_name" >a &&
- git commit -a -m "$test_name moved master" &&
- git tag -a -m "tagged move as r2" r2 &&
- git push origin master r2
-'
-
-test_expect_success 'moving branch back and deleting tag works' '
- git reset --hard HEAD^ &&
- git push --force origin master:master :r2
-'
-
-test_done
-
--- /dev/null
+#!/bin/sh
+
+test_description='server assign commit numbers'
+
+. ./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 &&
+ git fetch
+'
+
+install_post_receive_hook 'post-receive-assign-commit-numbers'
+
+test_expect_success 'assign one new commit' '
+ git checkout master &&
+ echo "$test_name" >a &&
+ git commit -a -m "changed a" &&
+ git push origin master &&
+ git fetch &&
+
+ test "$(git rev-parse HEAD)" = "$(git rev-parse r/1)" &&
+ test "$(git describe --tags)" = "r/1" &&
+ test "$(git rev-parse HEAD) refs/heads/master" = "$(cat server/.git/commitnumbers)"
+'
+
+test_expect_success 'assign two new commits' '
+ echo "$test_name first" >a &&
+ git commit -a -m "changed a first" &&
+ echo "$test_name second" >a &&
+ git commit -a -m "changed a second" &&
+ git push origin master &&
+ git fetch &&
+
+ test "$(git rev-parse HEAD)" = "$(git rev-parse r/3)" &&
+ test "$(git describe --tags)" = "r/3" &&
+
+ test "$(git rev-parse HEAD^)" = "$(git rev-parse r/2)" &&
+ test "$(git describe --tags HEAD^)" = "r/2"
+'
+
+test_expect_success 'pushing commits to a new branch does not reassign' '
+ git checkout -b topica &&
+ echo "$test_name" &&
+ git push origin topica &&
+ git fetch &&
+
+ ! git rev-parse r/4
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server assign commit numbers'
-
-. ./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 &&
- git fetch
-'
-
-install_post_receive_hook 'post-receive-assign-commit-numbers'
-
-test_expect_success 'assign one new commit' '
- git checkout master &&
- echo "$test_name" >a &&
- git commit -a -m "changed a" &&
- git push origin master &&
- git fetch &&
-
- test "$(git rev-parse HEAD)" = "$(git rev-parse r/1)" &&
- test "$(git describe --tags)" = "r/1" &&
- test "$(git rev-parse HEAD) refs/heads/master" = "$(cat server/.git/commitnumbers)"
-'
-
-test_expect_success 'assign two new commits' '
- echo "$test_name first" >a &&
- git commit -a -m "changed a first" &&
- echo "$test_name second" >a &&
- git commit -a -m "changed a second" &&
- git push origin master &&
- git fetch &&
-
- test "$(git rev-parse HEAD)" = "$(git rev-parse r/3)" &&
- test "$(git describe --tags)" = "r/3" &&
-
- test "$(git rev-parse HEAD^)" = "$(git rev-parse r/2)" &&
- test "$(git describe --tags HEAD^)" = "r/2"
-'
-
-test_expect_success 'pushing commits to a new branch does not reassign' '
- git checkout -b topica &&
- echo "$test_name" &&
- git push origin topica &&
- git fetch &&
-
- ! git rev-parse r/4
-'
-
-test_done
-