Flush out tattoo and tests.
[git-central.git] / tests / t5500-script-tattoo.sh
1 #!/bin/sh
2
3 test_description='script tattoo'
4
5 . ./test-lib.sh
6
7 export PATH=$PATH:../../scripts
8
9 test_expect_success 'setup' '
10         echo "setup" >a &&
11         git add a &&
12         git commit -m "setup" &&
13         git clone ./. server &&
14         rm -fr server/.git/hooks &&
15         git remote add origin ./server &&
16         git checkout -b stable &&
17         git push origin stable
18 '
19
20 test_expect_success 'tattoo 0' '
21         git checkout -b topic1 &&
22         git push origin topic1 &&
23         gc-tattoo | grep topic1-0
24 '
25
26 test_expect_success 'tattoo 1' '
27         echo "$test_name" >a &&
28         git commit -a -m "make topic1-1" &&
29         git push origin topic1 &&
30         gc-tattoo | grep topic1-1
31 '
32
33 test_expect_success 'merge topic2 topic1 as tattoo 2' '
34         git checkout -b topic2 stable &&
35         echo "$test_name" >a.topic2 &&
36         git add a.topic2
37         git commit -m "make topic2" &&
38         git push origin topic2 &&
39         gc-tattoo | grep topic2-1
40
41         git checkout topic1 &&
42         git merge topic2 &&
43         git push origin topic1 &&
44         gc-tattoo | grep topic1-2
45 '
46
47 test_expect_success 'stable without a tag' '
48         git checkout stable &&
49         head=$(git rev-parse HEAD) &&
50         gc-tattoo | grep "stable-$head"
51 '
52
53 test_expect_success 'stable with a tag' '
54         git tag -m "1.0" 1.0 &&
55         gc-tattoo | grep "1.0"
56 '
57
58 test_expect_success 'fails if not pushed' '
59         git checkout topic1 &&
60         echo "$test_name" >a &&
61         git commit -a -m "make topic1-3" &&
62         gc-tattoo | grep "topic1 has not been pushed"
63 '
64
65 test_expect_success 'stable fails if not pushed' '
66         git checkout stable &&
67         git merge --no-ff topic1 &&
68         gc-tattoo | grep "stable has not been pushed"
69 '
70
71 test_expect_success 'use origin stable not local' '
72         git checkout topic1 &&
73         git push origin topic1 &&
74         gc-tattoo | grep "topic1-3"
75 '
76
77 test_done
78