]>
Commit | Line | Data |
---|---|---|
cf7f929a SP |
1 | #!/bin/sh |
2 | ||
3 | test_description='test automatic tag following' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
8b02c64a JS |
7 | case $(uname -s) in |
8 | *MINGW*) | |
49f32489 ÆAB |
9 | say "GIT_DEBUG_SEND_PACK not supported - skipping tests" |
10 | ;; | |
11 | *) | |
12 | test_set_prereq NOT_MINGW | |
13 | ;; | |
8b02c64a JS |
14 | esac |
15 | ||
cf7f929a SP |
16 | # End state of the repository: |
17 | # | |
18 | # T - tag1 S - tag2 | |
19 | # / / | |
20 | # L - A ------ O ------ B | |
21 | # \ \ \ | |
22 | # \ C - origin/cat \ | |
23 | # origin/master master | |
24 | ||
49f32489 | 25 | test_expect_success NOT_MINGW setup ' |
cf7f929a SP |
26 | test_tick && |
27 | echo ichi >file && | |
28 | git add file && | |
29 | git commit -m L && | |
30 | L=$(git rev-parse --verify HEAD) && | |
31 | ||
32 | ( | |
33 | mkdir cloned && | |
34 | cd cloned && | |
35 | git init-db && | |
36 | git remote add -f origin .. | |
37 | ) && | |
38 | ||
39 | test_tick && | |
40 | echo A >file && | |
41 | git add file && | |
42 | git commit -m A && | |
43 | A=$(git rev-parse --verify HEAD) | |
44 | ' | |
45 | ||
46 | U=UPLOAD_LOG | |
47 | ||
49f32489 | 48 | test_expect_success NOT_MINGW 'setup expect' ' |
cf7f929a SP |
49 | cat - <<EOF >expect |
50 | #S | |
51 | want $A | |
52 | #E | |
53 | EOF | |
49f32489 ÆAB |
54 | ' |
55 | ||
56 | test_expect_success NOT_MINGW 'fetch A (new commit : 1 connection)' ' | |
cf7f929a SP |
57 | rm -f $U |
58 | ( | |
59 | cd cloned && | |
60 | GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U && | |
61 | test $A = $(git rev-parse --verify origin/master) | |
62 | ) && | |
63 | test -s $U && | |
64 | cut -d" " -f1,2 $U >actual && | |
3af82863 | 65 | test_cmp expect actual |
cf7f929a SP |
66 | ' |
67 | ||
49f32489 | 68 | test_expect_success NOT_MINGW "create tag T on A, create C on branch cat" ' |
cf7f929a SP |
69 | git tag -a -m tag1 tag1 $A && |
70 | T=$(git rev-parse --verify tag1) && | |
71 | ||
72 | git checkout -b cat && | |
73 | echo C >file && | |
74 | git add file && | |
75 | git commit -m C && | |
76 | C=$(git rev-parse --verify HEAD) && | |
77 | git checkout master | |
78 | ' | |
79 | ||
49f32489 | 80 | test_expect_success NOT_MINGW 'setup expect' ' |
cf7f929a SP |
81 | cat - <<EOF >expect |
82 | #S | |
83 | want $C | |
84 | want $T | |
85 | #E | |
86 | EOF | |
49f32489 ÆAB |
87 | ' |
88 | ||
89 | test_expect_success NOT_MINGW 'fetch C, T (new branch, tag : 1 connection)' ' | |
cf7f929a SP |
90 | rm -f $U |
91 | ( | |
92 | cd cloned && | |
93 | GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U && | |
94 | test $C = $(git rev-parse --verify origin/cat) && | |
95 | test $T = $(git rev-parse --verify tag1) && | |
96 | test $A = $(git rev-parse --verify tag1^0) | |
97 | ) && | |
98 | test -s $U && | |
99 | cut -d" " -f1,2 $U >actual && | |
3af82863 | 100 | test_cmp expect actual |
cf7f929a SP |
101 | ' |
102 | ||
49f32489 | 103 | test_expect_success NOT_MINGW "create commits O, B, tag S on B" ' |
cf7f929a SP |
104 | test_tick && |
105 | echo O >file && | |
106 | git add file && | |
107 | git commit -m O && | |
108 | ||
109 | test_tick && | |
110 | echo B >file && | |
111 | git add file && | |
112 | git commit -m B && | |
113 | B=$(git rev-parse --verify HEAD) && | |
114 | ||
115 | git tag -a -m tag2 tag2 $B && | |
116 | S=$(git rev-parse --verify tag2) | |
117 | ' | |
118 | ||
49f32489 | 119 | test_expect_success NOT_MINGW 'setup expect' ' |
cf7f929a SP |
120 | cat - <<EOF >expect |
121 | #S | |
122 | want $B | |
123 | want $S | |
124 | #E | |
125 | EOF | |
49f32489 ÆAB |
126 | ' |
127 | ||
128 | test_expect_success NOT_MINGW 'fetch B, S (commit and tag : 1 connection)' ' | |
cf7f929a SP |
129 | rm -f $U |
130 | ( | |
131 | cd cloned && | |
132 | GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U && | |
133 | test $B = $(git rev-parse --verify origin/master) && | |
134 | test $B = $(git rev-parse --verify tag2^0) && | |
135 | test $S = $(git rev-parse --verify tag2) | |
136 | ) && | |
137 | test -s $U && | |
138 | cut -d" " -f1,2 $U >actual && | |
3af82863 | 139 | test_cmp expect actual |
cf7f929a SP |
140 | ' |
141 | ||
49f32489 | 142 | test_expect_success NOT_MINGW 'setup expect' ' |
41fa7d2e SP |
143 | cat - <<EOF >expect |
144 | #S | |
145 | want $B | |
146 | want $S | |
147 | #E | |
148 | EOF | |
49f32489 ÆAB |
149 | ' |
150 | ||
151 | test_expect_success NOT_MINGW 'new clone fetch master and tags' ' | |
41fa7d2e SP |
152 | git branch -D cat |
153 | rm -f $U | |
154 | ( | |
155 | mkdir clone2 && | |
156 | cd clone2 && | |
157 | git init && | |
158 | git remote add origin .. && | |
159 | GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U && | |
160 | test $B = $(git rev-parse --verify origin/master) && | |
161 | test $S = $(git rev-parse --verify tag2) && | |
162 | test $B = $(git rev-parse --verify tag2^0) && | |
163 | test $T = $(git rev-parse --verify tag1) && | |
164 | test $A = $(git rev-parse --verify tag1^0) | |
165 | ) && | |
166 | test -s $U && | |
167 | cut -d" " -f1,2 $U >actual && | |
3af82863 | 168 | test_cmp expect actual |
41fa7d2e SP |
169 | ' |
170 | ||
cf7f929a | 171 | test_done |