3 test_description
='test automatic tag following'
9 say
"GIT_DEBUG_SEND_PACK not supported - skipping tests"
14 # End state of the repository:
18 # L - A ------ O ------ B
21 # origin/master master
23 test_expect_success setup
'
28 L=$(git rev-parse --verify HEAD) &&
34 git remote add -f origin ..
41 A=$(git rev-parse --verify HEAD)
51 test_expect_success
'fetch A (new commit : 1 connection)' '
55 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
56 test $A = $(git rev-parse --verify origin/master)
59 cut -d" " -f1,2 $U >actual &&
60 test_cmp expect actual
63 test_expect_success
"create tag T on A, create C on branch cat" '
64 git tag -a -m tag1 tag1 $A &&
65 T=$(git rev-parse --verify tag1) &&
67 git checkout -b cat &&
71 C=$(git rev-parse --verify HEAD) &&
81 test_expect_success
'fetch C, T (new branch, tag : 1 connection)' '
85 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
86 test $C = $(git rev-parse --verify origin/cat) &&
87 test $T = $(git rev-parse --verify tag1) &&
88 test $A = $(git rev-parse --verify tag1^0)
91 cut -d" " -f1,2 $U >actual &&
92 test_cmp expect actual
95 test_expect_success
"create commits O, B, tag S on B" '
105 B=$(git rev-parse --verify HEAD) &&
107 git tag -a -m tag2 tag2 $B &&
108 S=$(git rev-parse --verify tag2)
117 test_expect_success
'fetch B, S (commit and tag : 1 connection)' '
121 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
122 test $B = $(git rev-parse --verify origin/master) &&
123 test $B = $(git rev-parse --verify tag2^0) &&
124 test $S = $(git rev-parse --verify tag2)
127 cut -d" " -f1,2 $U >actual &&
128 test_cmp expect actual
137 test_expect_success
'new clone fetch master and tags' '
144 git remote add origin .. &&
145 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
146 test $B = $(git rev-parse --verify origin/master) &&
147 test $S = $(git rev-parse --verify tag2) &&
148 test $B = $(git rev-parse --verify tag2^0) &&
149 test $T = $(git rev-parse --verify tag1) &&
150 test $A = $(git rev-parse --verify tag1^0)
153 cut -d" " -f1,2 $U >actual &&
154 test_cmp expect actual