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)
46 *MINGW
*) test_expect
=test_expect_failure
;;
47 *) test_expect
=test_expect_success
;;
49 $test_expect 'fetch A (new commit : 1 connection)' '
53 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
54 test $A = $(git rev-parse --verify origin/master)
57 cut -d" " -f1,2 $U >actual &&
58 test_cmp expect actual
61 test_expect_success
"create tag T on A, create C on branch cat" '
62 git tag -a -m tag1 tag1 $A &&
63 T=$(git rev-parse --verify tag1) &&
65 git checkout -b cat &&
69 C=$(git rev-parse --verify HEAD) &&
80 *MINGW
*) test_expect
=test_expect_failure
;;
81 *) test_expect
=test_expect_success
;;
83 $test_expect 'fetch C, T (new branch, tag : 1 connection)' '
87 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
88 test $C = $(git rev-parse --verify origin/cat) &&
89 test $T = $(git rev-parse --verify tag1) &&
90 test $A = $(git rev-parse --verify tag1^0)
93 cut -d" " -f1,2 $U >actual &&
94 test_cmp expect actual
97 test_expect_success
"create commits O, B, tag S on B" '
107 B=$(git rev-parse --verify HEAD) &&
109 git tag -a -m tag2 tag2 $B &&
110 S=$(git rev-parse --verify tag2)
120 *MINGW
*) test_expect
=test_expect_failure
;;
121 *) test_expect
=test_expect_success
;;
123 $test_expect '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
144 *MINGW
*) test_expect
=test_expect_failure
;;
145 *) test_expect
=test_expect_success
;;
147 $test_expect 'new clone fetch master and tags' '
154 git remote add origin .. &&
155 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
156 test $B = $(git rev-parse --verify origin/master) &&
157 test $S = $(git rev-parse --verify tag2) &&
158 test $B = $(git rev-parse --verify tag2^0) &&
159 test $T = $(git rev-parse --verify tag1) &&
160 test $A = $(git rev-parse --verify tag1^0)
163 cut -d" " -f1,2 $U >actual &&
164 test_cmp expect actual