3 test_description='script tattoo'
7 export PATH=$PATH:../../scripts
9 test_expect_success 'setup' '
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
20 # tattoo makes assumptions based on the update stable hook sanity checks
21 install_update_hook 'update-stable'
22 install_post_receive_hook 'post-receive-assign-commit-numbers'
24 test_expect_success 'tattoo of unpublished commit fails' '
25 gc-tattoo | grep "No commit number tag found"
30 test_expect_success 'tattoo 1' '
31 git checkout -b topic1 &&
32 echo "$test_name" >a.topic1 &&
34 git commit -a -m "move topic1-1" &&
35 git push origin topic1 &&
36 gc-tattoo | grep topic1-1
39 test_expect_success 'tattoo 2' '
40 echo "$test_name" >a &&
41 git commit -a -m "make topic1-2" &&
42 git push origin topic1 &&
43 gc-tattoo | grep topic1-2
46 test_expect_success 'merge topic2 into topic1 as tattoo 3' '
47 git checkout -b topic2 stable &&
48 echo "$test_name" >a.topic2 &&
50 git commit -m "make topic2-1" &&
51 git push origin topic2 &&
52 gc-tattoo | grep topic2-1 &&
54 git checkout topic1 &&
56 git push origin topic1 &&
57 gc-tattoo | grep topic1-3 &&
59 git checkout topic2 &&
60 gc-tattoo | grep topic2-1
63 test_expect_success 'fails if not pushed' '
64 git checkout topic1 &&
65 echo "$test_name" >a &&
66 git commit -a -m "make topic1-4" &&
67 head=$(git rev-parse HEAD) &&
68 gc-tattoo | grep "$head has not been pushed" &&
69 git push origin topic1 &&
70 gc-tattoo | grep topic1-4
73 test_expect_success 'stable fails if not pushed' '
74 git checkout stable &&
75 git merge --no-ff topic1 &&
76 head=$(git rev-parse HEAD) &&
77 gc-tattoo | grep "$head has not been pushed" &&
79 gc-tattoo | grep "stable-$head"
82 test_expect_success 'stable without a tag' '
83 git checkout stable &&
84 head=$(git rev-parse HEAD) &&
85 gc-tattoo | grep "stable-$head"
88 test_expect_success 'stable with a tag' '
89 git tag -m "1.0" 1.0 &&
90 gc-tattoo | grep "1.0"
93 test_expect_success 'use origin stable not local' '
94 git checkout origin/stable &&
95 git branch -d stable &&
96 git checkout topic2 &&
97 gc-tattoo | grep "topic2-1"