3 test_description='test automatic tag following'
9 say "GIT_DEBUG_SEND_PACK not supported - skipping tests"
13 # End state of the repository:
17 # L - A ------ O ------ B
20 # origin/master master
22 test_expect_success setup '
27 L=$(git rev-parse --verify HEAD) &&
33 git remote add -f origin ..
40 A=$(git rev-parse --verify HEAD)
50 test_expect_success 'fetch A (new commit : 1 connection)' '
54 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
55 test $A = $(git rev-parse --verify origin/master)
58 cut -d" " -f1,2 $U >actual &&
59 test_cmp expect actual
62 test_expect_success "create tag T on A, create C on branch cat" '
63 git tag -a -m tag1 tag1 $A &&
64 T=$(git rev-parse --verify tag1) &&
66 git checkout -b cat &&
70 C=$(git rev-parse --verify HEAD) &&
80 test_expect_success 'fetch C, T (new branch, tag : 1 connection)' '
84 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
85 test $C = $(git rev-parse --verify origin/cat) &&
86 test $T = $(git rev-parse --verify tag1) &&
87 test $A = $(git rev-parse --verify tag1^0)
90 cut -d" " -f1,2 $U >actual &&
91 test_cmp expect actual
94 test_expect_success "create commits O, B, tag S on B" '
104 B=$(git rev-parse --verify HEAD) &&
106 git tag -a -m tag2 tag2 $B &&
107 S=$(git rev-parse --verify tag2)
116 test_expect_success 'fetch B, S (commit and tag : 1 connection)' '
120 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
121 test $B = $(git rev-parse --verify origin/master) &&
122 test $B = $(git rev-parse --verify tag2^0) &&
123 test $S = $(git rev-parse --verify tag2)
126 cut -d" " -f1,2 $U >actual &&
127 test_cmp expect actual
136 test_expect_success 'new clone fetch master and tags' '
143 git remote add origin .. &&
144 GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
145 test $B = $(git rev-parse --verify origin/master) &&
146 test $S = $(git rev-parse --verify tag2) &&
147 test $B = $(git rev-parse --verify tag2^0) &&
148 test $T = $(git rev-parse --verify tag1) &&
149 test $A = $(git rev-parse --verify tag1^0)
152 cut -d" " -f1,2 $U >actual &&
153 test_cmp expect actual