Add missing '&&' suffixes.
[git-central.git] / tests / t3200-server-post-receive-assign-commit-numbers.sh
1 #!/bin/sh
2
3 test_description='server assign commit numbers'
4
5 . ./test-lib.sh
6
7 test_expect_success 'setup' '
8         echo "setup" >a &&
9         git add a &&
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 &&
16         git fetch
17 '
18
19 install_post_receive_hook 'post-receive-assign-commit-numbers'
20
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 &&
26         git fetch &&
27
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)"
31 '
32
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 &&
39         git fetch &&
40
41         test "$(git rev-parse HEAD)" = "$(git rev-parse r/3)" &&
42         test "$(git describe --tags)" = "r/3" &&
43
44         test "$(git rev-parse HEAD^)" = "$(git rev-parse r/2)" &&
45         test "$(git describe --tags HEAD^)" = "r/2"
46 '
47
48 test_expect_success 'pushing commits to a new branch does not reassign' '
49         git checkout -b topica &&
50         echo "$test_name" &&
51         git push origin topica &&
52         git fetch &&
53
54         ! git rev-parse r/4
55 '
56
57 test_done
58