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)
40 test_expect_success 'setup expect' '
49 next unless $F[1] eq "upload-pack<";
50 last if $F[2] eq "0000";
51 print $F[2], " ", $F[3];
55 test_expect_success 'fetch A (new commit : 1 connection)' '
59 GIT_TRACE_PACKET=$UPATH git fetch &&
60 test $A = $(git rev-parse --verify origin/master)
62 get_needs $U >actual &&
63 test_cmp expect actual
66 test_expect_success "create tag T on A, create C on branch cat" '
67 git tag -a -m tag1 tag1 $A &&
68 T=$(git rev-parse --verify tag1) &&
70 git checkout -b cat &&
74 C=$(git rev-parse --verify HEAD) &&
78 test_expect_success 'setup expect' '
85 test_expect_success 'fetch C, T (new branch, tag : 1 connection)' '
89 GIT_TRACE_PACKET=$UPATH git fetch &&
90 test $C = $(git rev-parse --verify origin/cat) &&
91 test $T = $(git rev-parse --verify tag1) &&
92 test $A = $(git rev-parse --verify tag1^0)
94 get_needs $U >actual &&
95 test_cmp expect actual
98 test_expect_success "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 'setup expect' '
121 test_expect_success 'fetch B, S (commit and tag : 1 connection)' '
125 GIT_TRACE_PACKET=$UPATH git fetch &&
126 test $B = $(git rev-parse --verify origin/master) &&
127 test $B = $(git rev-parse --verify tag2^0) &&
128 test $S = $(git rev-parse --verify tag2)
130 get_needs $U >actual &&
131 test_cmp expect actual
134 test_expect_success 'setup expect' '
141 test_expect_success 'new clone fetch master and tags' '
148 git remote add origin .. &&
149 GIT_TRACE_PACKET=$UPATH git fetch &&
150 test $B = $(git rev-parse --verify origin/master) &&
151 test $S = $(git rev-parse --verify tag2) &&
152 test $B = $(git rev-parse --verify tag2^0) &&
153 test $T = $(git rev-parse --verify tag1) &&
154 test $A = $(git rev-parse --verify tag1^0)
156 get_needs $U >actual &&
157 test_cmp expect actual