Use quotes to avoid unary operator error.
[git-central.git] / tests / t3100-ensure-tag-in-branch.sh
1 #!/bin/sh
2
3 test_description='server update tags in branch check'
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 '
15
16 install_update_hook 'update-ensure-tag-in-branch'
17
18 test_expect_success 'push only tag fails' '
19         echo "$test_name" >a &&
20         git commit -a -m "$test_name moved master" &&
21         git tag -a -m "tagged move as r1" r1 &&
22         ! git push --tags 2>push.err &&
23         cat push.err | grep "The tag r1 is not included in any branch." &&
24
25         # But now it works if we push the commit first
26         git push &&
27         git push --tags
28 '
29
30 test_expect_success 'push works if done at the same time' '
31         echo "$test_name" >a &&
32         git commit -a -m "$test_name moved master" &&
33         git tag -a -m "tagged move as r2" r2 &&
34         git push origin master r2
35 '
36
37 test_expect_success 'moving branch back and deleting tag works' '
38         git reset --hard HEAD^ &&
39         git push --force origin master:master :r2
40 '
41
42 test_done
43