3 test_description='server assign commit numbers'
7 test_expect_success 'setup' '
10 git commit -m "setup" &&
11 git clone ./. server &&
12 rm -fr server/.git/hooks &&
13 git remote add origin ./server &&
14 git config --add branch.master.remote origin &&
15 git config --add branch.master.merge refs/heads/master &&
19 install_post_receive_hook 'post-receive-assign-commit-numbers'
21 test_expect_success 'assign one new commit' '
22 git checkout master &&
23 echo "$test_name" >a &&
24 git commit -a -m "changed a" &&
25 git push origin master &&
28 test "$(git rev-parse HEAD)" = "$(git rev-parse r/1)" &&
29 test "$(git describe --tags)" = "r/1" &&
30 test "$(git rev-parse HEAD) refs/heads/master" = "$(cat server/.git/commitnumbers)"
33 test_expect_success 'assign two new commits' '
34 echo "$test_name first" >a &&
35 git commit -a -m "changed a first" &&
36 echo "$test_name second" >a &&
37 git commit -a -m "changed a second" &&
38 git push origin master &&
41 test "$(git rev-parse HEAD)" = "$(git rev-parse r/3)" &&
42 test "$(git describe --tags)" = "r/3" &&
44 test "$(git rev-parse HEAD^)" = "$(git rev-parse r/2)" &&
45 test "$(git describe --tags HEAD^)" = "r/2"
48 test_expect_success 'pushing commits to a new branch does not reassign' '
49 git checkout -b topica &&
51 git push origin topica &&