3 test_description
='test automatic tag following'
7 # End state of the repository:
11 # L - A ------ O ------ B
14 # origin/master master
16 test_expect_success setup
'
21 L=$(git rev-parse --verify HEAD) &&
27 git remote add -f origin ..
34 A=$(git rev-parse --verify HEAD)
44 test_expect_success
'fetch A (new commit : 1 connection)' '
48 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
49 test $A = $(git rev-parse --verify origin/master)
52 cut -d" " -f1,2 $U >actual &&
53 test_cmp expect actual
56 test_expect_success
"create tag T on A, create C on branch cat" '
57 git tag -a -m tag1 tag1 $A &&
58 T=$(git rev-parse --verify tag1) &&
60 git checkout -b cat &&
64 C=$(git rev-parse --verify HEAD) &&
74 test_expect_success
'fetch C, T (new branch, tag : 1 connection)' '
78 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
79 test $C = $(git rev-parse --verify origin/cat) &&
80 test $T = $(git rev-parse --verify tag1) &&
81 test $A = $(git rev-parse --verify tag1^0)
84 cut -d" " -f1,2 $U >actual &&
85 test_cmp expect actual
88 test_expect_success
"create commits O, B, tag S on B" '
98 B=$(git rev-parse --verify HEAD) &&
100 git tag -a -m tag2 tag2 $B &&
101 S=$(git rev-parse --verify tag2)
110 test_expect_success
'fetch B, S (commit and tag : 1 connection)' '
114 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
115 test $B = $(git rev-parse --verify origin/master) &&
116 test $B = $(git rev-parse --verify tag2^0) &&
117 test $S = $(git rev-parse --verify tag2)
120 cut -d" " -f1,2 $U >actual &&
121 test_cmp expect actual
130 test_expect_success
'new clone fetch master and tags' '
137 git remote add origin .. &&
138 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
139 test $B = $(git rev-parse --verify origin/master) &&
140 test $S = $(git rev-parse --verify tag2) &&
141 test $B = $(git rev-parse --verify tag2^0) &&
142 test $T = $(git rev-parse --verify tag1) &&
143 test $A = $(git rev-parse --verify tag1^0)
146 cut -d" " -f1,2 $U >actual &&
147 test_cmp expect actual