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/0)"
29 test "$(git describe --tags)" = "r/0"
32 test_expect_success 'assign two new commits' '
33 echo "$test_name first" >a &&
34 git commit -a -m "changed a first" &&
35 echo "$test_name second" >a &&
36 git commit -a -m "changed a second" &&
37 git push origin master &&
40 test "$(git rev-parse HEAD)" = "$(git rev-parse r/2)"
41 test "$(git describe --tags)" = "r/2"
43 test "$(git rev-parse HEAD^)" = "$(git rev-parse r/1)"
44 test "$(git describe --tags HEAD^)" = "r/1"
47 test_expect_success 'pushing commits to a new branch does not reassign' '
48 git checkout -b topica &&
50 git push origin topica &&