3 test_description
='test automatic tag following'
7 if ! test_have_prereq NOT_MINGW
; then
8 say
"GIT_TRACE_PACKET 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 next unless $F[1] eq "upload-pack<";
52 last if $F[2] eq "0000";
53 print $F[2], " ", $F[3];
57 test_expect_success NOT_MINGW
'fetch A (new commit : 1 connection)' '
61 GIT_TRACE_PACKET=3 git fetch 3>../$U &&
62 test $A = $(git rev-parse --verify origin/master)
64 get_needs $U >actual &&
65 test_cmp expect actual
68 test_expect_success NOT_MINGW
"create tag T on A, create C on branch cat" '
69 git tag -a -m tag1 tag1 $A &&
70 T=$(git rev-parse --verify tag1) &&
72 git checkout -b cat &&
76 C=$(git rev-parse --verify HEAD) &&
80 test_expect_success NOT_MINGW
'setup expect' '
87 test_expect_success NOT_MINGW
'fetch C, T (new branch, tag : 1 connection)' '
91 GIT_TRACE_PACKET=3 git fetch 3>../$U &&
92 test $C = $(git rev-parse --verify origin/cat) &&
93 test $T = $(git rev-parse --verify tag1) &&
94 test $A = $(git rev-parse --verify tag1^0)
96 get_needs $U >actual &&
97 test_cmp expect actual
100 test_expect_success NOT_MINGW
"create commits O, B, tag S on B" '
110 B=$(git rev-parse --verify HEAD) &&
112 git tag -a -m tag2 tag2 $B &&
113 S=$(git rev-parse --verify tag2)
116 test_expect_success NOT_MINGW
'setup expect' '
123 test_expect_success NOT_MINGW
'fetch B, S (commit and tag : 1 connection)' '
127 GIT_TRACE_PACKET=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)
132 get_needs $U >actual &&
133 test_cmp expect actual
136 test_expect_success NOT_MINGW
'setup expect' '
143 test_expect_success NOT_MINGW
'new clone fetch master and tags' '
150 git remote add origin .. &&
151 GIT_TRACE_PACKET=3 git fetch 3>../$U &&
152 test $B = $(git rev-parse --verify origin/master) &&
153 test $S = $(git rev-parse --verify tag2) &&
154 test $B = $(git rev-parse --verify tag2^0) &&
155 test $T = $(git rev-parse --verify tag1) &&
156 test $A = $(git rev-parse --verify tag1^0)
158 get_needs $U >actual &&
159 test_cmp expect actual