3 test_description
='test automatic tag following'
7 if !test_have_prereq NOT_MINGW
; then
8 say
"GIT_DEBUG_SEND_PACK not supported - skipping tests"
11 # End state of the repository:
15 # L - A ------ O ------ B
18 # origin/master master
20 test_expect_success NOT_MINGW setup
'
25 L=$(git rev-parse --verify HEAD) &&
31 git remote add -f origin ..
38 A=$(git rev-parse --verify HEAD)
43 test_expect_success NOT_MINGW
'setup expect' '
51 test_expect_success NOT_MINGW
'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 NOT_MINGW
"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) &&
75 test_expect_success NOT_MINGW
'setup expect' '
84 test_expect_success NOT_MINGW
'fetch C, T (new branch, tag : 1 connection)' '
88 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
89 test $C = $(git rev-parse --verify origin/cat) &&
90 test $T = $(git rev-parse --verify tag1) &&
91 test $A = $(git rev-parse --verify tag1^0)
94 cut -d" " -f1,2 $U >actual &&
95 test_cmp expect actual
98 test_expect_success NOT_MINGW
"create commits O, B, tag S on B" '
108 B=$(git rev-parse --verify HEAD) &&
110 git tag -a -m tag2 tag2 $B &&
111 S=$(git rev-parse --verify tag2)
114 test_expect_success NOT_MINGW
'setup expect' '
123 test_expect_success NOT_MINGW
'fetch B, S (commit and tag : 1 connection)' '
127 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
128 test $B = $(git rev-parse --verify origin/master) &&
129 test $B = $(git rev-parse --verify tag2^0) &&
130 test $S = $(git rev-parse --verify tag2)
133 cut -d" " -f1,2 $U >actual &&
134 test_cmp expect actual
137 test_expect_success NOT_MINGW
'setup expect' '
146 test_expect_success NOT_MINGW
'new clone fetch master and tags' '
153 git remote add origin .. &&
154 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
155 test $B = $(git rev-parse --verify origin/master) &&
156 test $S = $(git rev-parse --verify tag2) &&
157 test $B = $(git rev-parse --verify tag2^0) &&
158 test $T = $(git rev-parse --verify tag1) &&
159 test $A = $(git rev-parse --verify tag1^0)
162 cut -d" " -f1,2 $U >actual &&
163 test_cmp expect actual