3 c8c71e6e 2020-03-21 stsp # Copyright (c) 2020 Stefan Sperling <stsp@openbsd.org>
5 c8c71e6e 2020-03-21 stsp # Permission to use, copy, modify, and distribute this software for any
6 c8c71e6e 2020-03-21 stsp # purpose with or without fee is hereby granted, provided that the above
7 c8c71e6e 2020-03-21 stsp # copyright notice and this permission notice appear in all copies.
9 c8c71e6e 2020-03-21 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 c8c71e6e 2020-03-21 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 c8c71e6e 2020-03-21 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 c8c71e6e 2020-03-21 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 c8c71e6e 2020-03-21 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 c8c71e6e 2020-03-21 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 c8c71e6e 2020-03-21 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 c8c71e6e 2020-03-21 stsp . ./common.sh
19 c8c71e6e 2020-03-21 stsp function test_fetch_basic {
20 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_basic`
21 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
22 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
24 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
26 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
27 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
28 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
32 c8c71e6e 2020-03-21 stsp echo "modified alpha" > $testroot/repo/alpha
33 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
34 c8c71e6e 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
36 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
37 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
38 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
39 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
43 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone > $testroot/stdout \
44 c8c71e6e 2020-03-21 stsp 2> $testroot/stderr
46 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
47 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
48 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
52 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
54 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
56 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
57 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
58 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
62 c8c71e6e 2020-03-21 stsp got log -l0 -p -r $testroot/repo > $testroot/log-repo
63 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
64 c8c71e6e 2020-03-21 stsp echo "got log command failed unexpectedly" >&2
65 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
68 c8c71e6e 2020-03-21 stsp got log -l0 -p -r $testroot/repo > $testroot/log-repo-clone
69 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
70 c8c71e6e 2020-03-21 stsp echo "got log command failed unexpectedly" >&2
71 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
74 c8c71e6e 2020-03-21 stsp cmp -s $testroot/log-repo $testroot/log-repo-clone
76 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
77 c8c71e6e 2020-03-21 stsp echo "log -p output of cloned repository differs" >&2
78 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
82 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo > $testroot/stdout
83 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
84 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
85 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
89 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
90 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
92 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
94 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
95 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
96 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
100 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
101 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
102 c8c71e6e 2020-03-21 stsp echo "got ref command failed unexpectedly" >&2
103 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
107 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
108 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
109 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
110 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
112 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
114 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
115 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
117 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
120 c8c71e6e 2020-03-21 stsp function test_fetch_list {
121 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_list`
122 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
123 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
125 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
126 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
127 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
129 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
131 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
132 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
133 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
137 c8c71e6e 2020-03-21 stsp (cd $testroot/repo-clone && got fetch -l \
138 c8c71e6e 2020-03-21 stsp > $testroot/stdout 2>$testroot/stderr)
140 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
141 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
142 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
146 c8c71e6e 2020-03-21 stsp echo "Connected to \"origin\" 127.0.0.1" > $testroot/stdout.expected
147 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo >> $testroot/stdout.expected
149 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
151 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
152 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
154 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
157 c8c71e6e 2020-03-21 stsp function test_fetch_branch {
158 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_branch`
159 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
160 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
162 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
164 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
165 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
166 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
170 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
171 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
172 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
173 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
174 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
176 c8c71e6e 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
177 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
178 c8c71e6e 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
180 c8c71e6e 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
181 c8c71e6e 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
182 c8c71e6e 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
183 c8c71e6e 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
185 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -b foo > $testroot/stdout
187 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
188 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
189 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
193 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
195 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
197 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
198 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
199 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
203 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
205 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
206 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
207 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
208 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
209 c8c71e6e 2020-03-21 stsp # refs/remotes/origin/master is umodified because it wasn't fetched
210 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
211 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
212 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
213 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
215 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
217 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
218 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
219 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
223 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -b master > $testroot/stdout
225 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
226 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
227 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
231 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
233 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
235 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
236 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
237 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
241 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
243 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
244 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
245 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
246 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
247 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
248 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
249 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
250 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
252 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
254 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
255 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
257 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
260 c8c71e6e 2020-03-21 stsp function test_fetch_all {
261 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_all`
262 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
263 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
265 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
267 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
268 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
269 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
273 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
274 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
275 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
276 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
277 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
279 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
281 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
282 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
283 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
284 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
285 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
287 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
289 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
290 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
291 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
295 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
297 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
298 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
299 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
303 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
305 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
306 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
307 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
308 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
309 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
310 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
311 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
312 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
314 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
316 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
317 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
319 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
322 c8c71e6e 2020-03-21 stsp function test_fetch_empty_packfile {
323 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_empty_packfile`
324 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
325 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
327 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
328 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
329 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
331 c8c71e6e 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
333 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
334 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
335 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
339 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
340 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
342 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
344 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
345 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
346 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
347 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
348 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
349 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
351 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
353 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
354 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
355 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
359 c8c71e6e 2020-03-21 stsp got fetch -q -a -r $testroot/repo-clone
361 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
362 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
363 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
367 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
369 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
370 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
371 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
372 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
373 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
374 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
375 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
376 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
378 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
380 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
381 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
383 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
386 c8c71e6e 2020-03-21 stsp function test_fetch_delete_branch {
387 c8c71e6e 2020-03-21 stsp local testroot=`test_init fetch_delete_branch`
388 c8c71e6e 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
389 c8c71e6e 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
392 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
393 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
394 c8c71e6e 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
395 c8c71e6e 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
396 c8c71e6e 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
398 c8c71e6e 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
400 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
401 c8c71e6e 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
402 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
406 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
408 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
409 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
410 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
411 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
412 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
413 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
414 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
415 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
416 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
418 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
420 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
421 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
422 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
426 c8c71e6e 2020-03-21 stsp got branch -r $testroot/repo -d foo
428 c8c71e6e 2020-03-21 stsp got fetch -q -r $testroot/repo-clone
430 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
431 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
432 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
436 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
438 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
439 c8c71e6e 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
440 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
441 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
442 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
443 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
444 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
445 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
447 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
449 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
450 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
451 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
455 c8c71e6e 2020-03-21 stsp got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
457 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
458 c8c71e6e 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
459 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
463 c8c71e6e 2020-03-21 stsp echo -n > $testroot/stdout.expected
465 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
467 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
468 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
469 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
473 c8c71e6e 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
475 c8c71e6e 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
476 c8c71e6e 2020-03-21 stsp # refs/heads/foo is now deleted
477 c8c71e6e 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
478 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
479 c8c71e6e 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
480 c8c71e6e 2020-03-21 stsp >> $testroot/stdout.expected
481 c8c71e6e 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
482 c8c71e6e 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
484 c8c71e6e 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
486 c8c71e6e 2020-03-21 stsp if [ "$ret" != "0" ]; then
487 c8c71e6e 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
489 c8c71e6e 2020-03-21 stsp test_done "$testroot" "$ret"
493 db6d8ad8 2020-03-21 stsp function test_fetch_update_tag {
494 db6d8ad8 2020-03-21 stsp local testroot=`test_init fetch_update_tag`
495 db6d8ad8 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
496 db6d8ad8 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
499 db6d8ad8 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
500 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
501 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
502 db6d8ad8 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
503 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
505 db6d8ad8 2020-03-21 stsp got clone -a -q $testurl/repo $testroot/repo-clone
507 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
508 db6d8ad8 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
509 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
513 db6d8ad8 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
514 db6d8ad8 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
515 db6d8ad8 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
517 db6d8ad8 2020-03-21 stsp got ref -r $testroot/repo -d "refs/tags/1.0" >/dev/null
518 db6d8ad8 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id2 -m tag "1.0" >/dev/null
519 db6d8ad8 2020-03-21 stsp local tag_id2=`got ref -r $testroot/repo -l \
520 db6d8ad8 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
522 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
524 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
525 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
526 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
527 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" \
528 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
529 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id" \
530 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
531 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
532 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
534 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
536 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
537 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
538 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
542 db6d8ad8 2020-03-21 stsp got fetch -q -r $testroot/repo-clone
544 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
545 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
546 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
550 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
552 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
553 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
554 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
555 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
556 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
557 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
558 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
559 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
561 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
563 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
564 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
565 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
569 db6d8ad8 2020-03-21 stsp got fetch -r $testroot/repo-clone 2> $testroot/stderr | \
570 db6d8ad8 2020-03-21 stsp tail -n 1 > $testroot/stdout
572 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
573 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
574 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
578 db6d8ad8 2020-03-21 stsp echo "Rejecting update of existing tag refs/tags/1.0: $tag_id2" \
579 db6d8ad8 2020-03-21 stsp > $testroot/stdout.expected
581 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
583 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
584 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
585 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
589 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
591 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
592 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
593 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
594 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
595 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
596 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
597 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
598 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
600 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
602 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
603 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
604 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
608 db6d8ad8 2020-03-21 stsp got fetch -q -t -r $testroot/repo-clone > $testroot/stdout
610 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
611 db6d8ad8 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
612 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
616 db6d8ad8 2020-03-21 stsp echo -n > $testroot/stdout.expected
618 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
620 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
621 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
622 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
626 db6d8ad8 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
628 db6d8ad8 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
629 db6d8ad8 2020-03-21 stsp echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
630 db6d8ad8 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
631 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
632 db6d8ad8 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
633 db6d8ad8 2020-03-21 stsp >> $testroot/stdout.expected
634 db6d8ad8 2020-03-21 stsp # refs/hoo/boo/zoo is missing because it is outside of refs/heads
635 db6d8ad8 2020-03-21 stsp echo "refs/tags/1.0: $tag_id2" >> $testroot/stdout.expected
637 db6d8ad8 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
639 db6d8ad8 2020-03-21 stsp if [ "$ret" != "0" ]; then
640 db6d8ad8 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
642 db6d8ad8 2020-03-21 stsp test_done "$testroot" "$ret"
645 0e4002ca 2020-03-21 stsp function test_fetch_reference {
646 0e4002ca 2020-03-21 stsp local testroot=`test_init fetch_reference`
647 0e4002ca 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
648 0e4002ca 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
650 0e4002ca 2020-03-21 stsp got clone -q $testurl/repo $testroot/repo-clone
652 0e4002ca 2020-03-21 stsp if [ "$ret" != "0" ]; then
653 0e4002ca 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
654 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
658 0e4002ca 2020-03-21 stsp got branch -r $testroot/repo -c $commit_id foo
659 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
660 0e4002ca 2020-03-21 stsp got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
661 0e4002ca 2020-03-21 stsp local tag_id=`got ref -r $testroot/repo -l \
662 0e4002ca 2020-03-21 stsp | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
664 0e4002ca 2020-03-21 stsp echo "modified alpha on master" > $testroot/repo/alpha
665 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
666 0e4002ca 2020-03-21 stsp local commit_id2=`git_show_head $testroot/repo`
668 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q foo)
669 0e4002ca 2020-03-21 stsp echo "modified alpha on foo" > $testroot/repo/alpha
670 0e4002ca 2020-03-21 stsp git_commit $testroot/repo -m "modified alpha"
671 0e4002ca 2020-03-21 stsp local commit_id3=`git_show_head $testroot/repo`
672 0e4002ca 2020-03-21 stsp (cd $testroot/repo && git checkout -q master)
674 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/remotes/origin/main \
675 0e4002ca 2020-03-21 stsp > $testroot/stdout 2> $testroot/stderr
677 0e4002ca 2020-03-21 stsp if [ "$ret" == "0" ]; then
678 0e4002ca 2020-03-21 stsp echo "got fetch command succeeded unexpectedly" >&2
679 ecdc3b49 2020-03-21 stsp test_done "$testroot" "1"
683 0e4002ca 2020-03-21 stsp echo -n > $testroot/stdout.expected
685 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
687 0e4002ca 2020-03-21 stsp if [ "$ret" != "0" ]; then
688 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
689 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
693 0e4002ca 2020-03-21 stsp echo "got: refs/remotes/origin/main: reference cannot be fetched" \
694 0e4002ca 2020-03-21 stsp > $testroot/stderr.expected
696 0e4002ca 2020-03-21 stsp cmp -s $testroot/stderr $testroot/stderr.expected
698 0e4002ca 2020-03-21 stsp if [ "$ret" != "0" ]; then
699 0e4002ca 2020-03-21 stsp diff -u $testroot/stderr.expected $testroot/stderr
700 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
704 0e4002ca 2020-03-21 stsp got fetch -q -r $testroot/repo-clone -R refs/hoo
706 0e4002ca 2020-03-21 stsp if [ "$ret" != "0" ]; then
707 0e4002ca 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
708 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
712 0e4002ca 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
714 0e4002ca 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
715 0e4002ca 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
716 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
717 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
718 0e4002ca 2020-03-21 stsp echo "refs/remotes/origin/master: $commit_id2" \
719 0e4002ca 2020-03-21 stsp >> $testroot/stdout.expected
720 0e4002ca 2020-03-21 stsp echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
722 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
724 e8a967e0 2020-03-21 stsp if [ "$ret" != "0" ]; then
725 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
727 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
731 e8a967e0 2020-03-21 stsp function test_fetch_replace_symref {
732 e8a967e0 2020-03-21 stsp local testroot=`test_init fetch_replace_symref`
733 e8a967e0 2020-03-21 stsp local testurl=ssh://127.0.0.1/$testroot
734 e8a967e0 2020-03-21 stsp local commit_id=`git_show_head $testroot/repo`
736 e8a967e0 2020-03-21 stsp got clone -m -q $testurl/repo $testroot/repo-clone
738 e8a967e0 2020-03-21 stsp if [ "$ret" != "0" ]; then
739 e8a967e0 2020-03-21 stsp echo "got clone command failed unexpectedly" >&2
740 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
744 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
745 e31abbf2 2020-03-22 stsp got ref -r $testroot/repo-clone -s refs/heads/master refs/hoo/boo/zoo
747 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
749 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
750 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
751 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: refs/heads/master" >> $testroot/stdout.expected
753 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
755 e8a967e0 2020-03-21 stsp if [ "$ret" != "0" ]; then
756 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
757 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
761 e8a967e0 2020-03-21 stsp got fetch -r $testroot/repo-clone -R refs/hoo \
762 e8a967e0 2020-03-21 stsp 2> $testroot/stderr | grep ^Replacing > $testroot/stdout
764 e8a967e0 2020-03-21 stsp if [ "$ret" != "0" ]; then
765 e8a967e0 2020-03-21 stsp echo "got fetch command failed unexpectedly" >&2
766 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
770 e8a967e0 2020-03-21 stsp echo "Replacing reference refs/hoo/boo/zoo: refs/heads/master" \
771 e8a967e0 2020-03-21 stsp > $testroot/stdout.expected
773 0e4002ca 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
775 0e4002ca 2020-03-21 stsp if [ "$ret" != "0" ]; then
776 0e4002ca 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
777 e8a967e0 2020-03-21 stsp test_done "$testroot" "$ret"
781 e8a967e0 2020-03-21 stsp got ref -l -r $testroot/repo-clone > $testroot/stdout
783 e8a967e0 2020-03-21 stsp echo "HEAD: refs/heads/master" > $testroot/stdout.expected
784 e8a967e0 2020-03-21 stsp echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
785 e8a967e0 2020-03-21 stsp echo "refs/hoo/boo/zoo: $commit_id" >> $testroot/stdout.expected
787 e8a967e0 2020-03-21 stsp cmp -s $testroot/stdout $testroot/stdout.expected
789 e8a967e0 2020-03-21 stsp if [ "$ret" != "0" ]; then
790 e8a967e0 2020-03-21 stsp diff -u $testroot/stdout.expected $testroot/stdout
792 0e4002ca 2020-03-21 stsp test_done "$testroot" "$ret"
796 c8c71e6e 2020-03-21 stsp run_test test_fetch_basic
797 c8c71e6e 2020-03-21 stsp run_test test_fetch_list
798 c8c71e6e 2020-03-21 stsp run_test test_fetch_branch
799 c8c71e6e 2020-03-21 stsp run_test test_fetch_all
800 c8c71e6e 2020-03-21 stsp run_test test_fetch_empty_packfile
801 c8c71e6e 2020-03-21 stsp run_test test_fetch_delete_branch
802 db6d8ad8 2020-03-21 stsp run_test test_fetch_update_tag
803 0e4002ca 2020-03-21 stsp run_test test_fetch_reference
804 e8a967e0 2020-03-21 stsp run_test test_fetch_replace_symref