3 # Copyright (c) 2020 Stefan Sperling <stsp@openbsd.org>
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 local testroot=`test_init fetch_basic`
21 local testurl=ssh://127.0.0.1/$testroot
22 local commit_id=`git_show_head $testroot/repo`
24 got clone -q $testurl/repo $testroot/repo-clone
26 if [ $ret -ne 0 ]; then
27 echo "got clone command failed unexpectedly" >&2
28 test_done "$testroot" "$ret"
32 echo "modified alpha" > $testroot/repo/alpha
33 git_commit $testroot/repo -m "modified alpha"
34 local commit_id2=`git_show_head $testroot/repo`
36 got ref -l -r $testroot/repo-clone > $testroot/stdout
38 if [ $ret -ne 0 ]; then
39 echo "got ref command failed unexpectedly" >&2
40 test_done "$testroot" "$ret"
44 got fetch -q -r $testroot/repo-clone > $testroot/stdout \
47 if [ $ret -ne 0 ]; then
48 echo "got fetch command failed unexpectedly" >&2
49 test_done "$testroot" "$ret"
53 echo -n > $testroot/stdout.expected
55 cmp -s $testroot/stdout $testroot/stdout.expected
57 if [ $ret -ne 0 ]; then
58 diff -u $testroot/stdout.expected $testroot/stdout
59 test_done "$testroot" "$ret"
63 got log -l0 -p -r $testroot/repo > $testroot/log-repo
65 if [ $ret -ne 0 ]; then
66 echo "got log command failed unexpectedly" >&2
67 test_done "$testroot" "$ret"
70 got log -l0 -p -r $testroot/repo > $testroot/log-repo-clone
72 if [ $ret -ne 0 ]; then
73 echo "got log command failed unexpectedly" >&2
74 test_done "$testroot" "$ret"
77 cmp -s $testroot/log-repo $testroot/log-repo-clone
79 if [ $ret -ne 0 ]; then
80 echo "log -p output of cloned repository differs" >&2
81 test_done "$testroot" "$ret"
85 got ref -l -r $testroot/repo > $testroot/stdout
87 if [ $ret -ne 0 ]; then
88 echo "got ref command failed unexpectedly" >&2
89 test_done "$testroot" "$ret"
93 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
94 echo "refs/heads/master: $commit_id2" >> $testroot/stdout.expected
96 cmp -s $testroot/stdout $testroot/stdout.expected
98 if [ $ret -ne 0 ]; then
99 diff -u $testroot/stdout.expected $testroot/stdout
100 test_done "$testroot" "$ret"
104 got ref -l -r $testroot/repo-clone > $testroot/stdout
106 if [ $ret -ne 0 ]; then
107 echo "got ref command failed unexpectedly" >&2
108 test_done "$testroot" "$ret"
112 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
113 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
114 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
115 >> $testroot/stdout.expected
116 echo "refs/remotes/origin/master: $commit_id2" \
117 >> $testroot/stdout.expected
119 cmp -s $testroot/stdout $testroot/stdout.expected
121 if [ $ret -ne 0 ]; then
122 diff -u $testroot/stdout.expected $testroot/stdout
124 test_done "$testroot" "$ret"
128 local testroot=`test_init fetch_list`
129 local testurl=ssh://127.0.0.1/$testroot
130 local commit_id=`git_show_head $testroot/repo`
132 got branch -r $testroot/repo -c $commit_id foo
133 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
134 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
136 got clone -q $testurl/repo $testroot/repo-clone
138 if [ $ret -ne 0 ]; then
139 echo "got clone command failed unexpectedly" >&2
140 test_done "$testroot" "$ret"
144 (cd $testroot/repo-clone && got fetch -q -l \
145 > $testroot/stdout 2>$testroot/stderr)
147 if [ $ret -ne 0 ]; then
148 echo "got fetch command failed unexpectedly" >&2
149 test_done "$testroot" "$ret"
153 got ref -l -r $testroot/repo > $testroot/stdout.expected
155 cmp -s $testroot/stdout $testroot/stdout.expected
157 if [ $ret -ne 0 ]; then
158 diff -u $testroot/stdout.expected $testroot/stdout
160 test_done "$testroot" "$ret"
163 test_fetch_branch() {
164 local testroot=`test_init fetch_branch`
165 local testurl=ssh://127.0.0.1/$testroot
166 local commit_id=`git_show_head $testroot/repo`
168 got clone -q $testurl/repo $testroot/repo-clone
170 if [ $ret -ne 0 ]; then
171 echo "got clone command failed unexpectedly" >&2
172 test_done "$testroot" "$ret"
176 got branch -r $testroot/repo -c $commit_id foo
177 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
178 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
179 local tag_id=`got ref -r $testroot/repo -l \
180 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
182 echo "modified alpha on master" > $testroot/repo/alpha
183 git_commit $testroot/repo -m "modified alpha"
184 local commit_id2=`git_show_head $testroot/repo`
186 (cd $testroot/repo && git checkout -q foo)
187 echo "modified alpha on foo" > $testroot/repo/alpha
188 git_commit $testroot/repo -m "modified alpha"
189 local commit_id3=`git_show_head $testroot/repo`
191 got fetch -q -r $testroot/repo-clone -b foo > $testroot/stdout
193 if [ $ret -ne 0 ]; then
194 echo "got fetch command failed unexpectedly" >&2
195 test_done "$testroot" "$ret"
199 echo -n > $testroot/stdout.expected
201 cmp -s $testroot/stdout $testroot/stdout.expected
203 if [ $ret -ne 0 ]; then
204 diff -u $testroot/stdout.expected $testroot/stdout
205 test_done "$testroot" "$ret"
209 got ref -l -r $testroot/repo-clone > $testroot/stdout
211 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
212 echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
213 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
214 echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
215 >> $testroot/stdout.expected
216 echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
217 # refs/remotes/origin/master is umodified because it wasn't fetched
218 echo "refs/remotes/origin/master: $commit_id" \
219 >> $testroot/stdout.expected
220 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
221 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
223 cmp -s $testroot/stdout $testroot/stdout.expected
225 if [ $ret -ne 0 ]; then
226 diff -u $testroot/stdout.expected $testroot/stdout
227 test_done "$testroot" "$ret"
231 got fetch -q -r $testroot/repo-clone -b master > $testroot/stdout
233 if [ $ret -ne 0 ]; then
234 echo "got fetch command failed unexpectedly" >&2
235 test_done "$testroot" "$ret"
239 echo -n > $testroot/stdout.expected
241 cmp -s $testroot/stdout $testroot/stdout.expected
243 if [ $ret -ne 0 ]; then
244 diff -u $testroot/stdout.expected $testroot/stdout
245 test_done "$testroot" "$ret"
249 got ref -l -r $testroot/repo-clone > $testroot/stdout
251 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
252 echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
253 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
254 echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
255 >> $testroot/stdout.expected
256 echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
257 echo "refs/remotes/origin/master: $commit_id2" \
258 >> $testroot/stdout.expected
259 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
260 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
262 cmp -s $testroot/stdout $testroot/stdout.expected
264 if [ $ret -ne 0 ]; then
265 diff -u $testroot/stdout.expected $testroot/stdout
266 test_done "$testroot" "$ret"
270 echo "modified beta on foo" > $testroot/repo/beta
271 git_commit $testroot/repo -m "modified beta"
272 local commit_id4=`git_show_head $testroot/repo`
274 got checkout -b foo $testroot/repo-clone $testroot/wt > /dev/null
276 # fetch new commits on branch 'foo', implicitly obtaining the
277 # branch name from a work tree
278 (cd $testroot/wt && got fetch -q > $testroot/stdout)
280 echo -n > $testroot/stdout.expected
282 cmp -s $testroot/stdout $testroot/stdout.expected
284 if [ $ret -ne 0 ]; then
285 diff -u $testroot/stdout.expected $testroot/stdout
286 test_done "$testroot" "$ret"
290 wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
291 cut -d ':' -f 2 | tr -d ' ')`
293 got ref -l -r $testroot/repo-clone > $testroot/stdout
295 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
296 echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \
297 >> $testroot/stdout.expected
298 echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
299 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
300 echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
301 >> $testroot/stdout.expected
302 echo "refs/remotes/origin/foo: $commit_id4" >> $testroot/stdout.expected
303 echo "refs/remotes/origin/master: $commit_id2" \
304 >> $testroot/stdout.expected
305 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
306 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
308 cmp -s $testroot/stdout $testroot/stdout.expected
310 if [ $ret -ne 0 ]; then
311 diff -u $testroot/stdout.expected $testroot/stdout
313 test_done "$testroot" "$ret"
317 local testroot=`test_init fetch_all`
318 local testurl=ssh://127.0.0.1/$testroot
319 local commit_id=`git_show_head $testroot/repo`
321 got clone -q $testurl/repo $testroot/repo-clone
323 if [ $ret -ne 0 ]; then
324 echo "got clone command failed unexpectedly" >&2
325 test_done "$testroot" "$ret"
329 got branch -r $testroot/repo -c $commit_id foo
330 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
331 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
332 local tag_id=`got ref -r $testroot/repo -l \
333 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
335 got ref -l -r $testroot/repo-clone > $testroot/stdout
337 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
338 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
339 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
340 >> $testroot/stdout.expected
341 echo "refs/remotes/origin/master: $commit_id" \
342 >> $testroot/stdout.expected
343 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
345 cmp -s $testroot/stdout $testroot/stdout.expected
347 if [ $ret -ne 0 ]; then
348 diff -u $testroot/stdout.expected $testroot/stdout
349 test_done "$testroot" "$ret"
353 got fetch -q -a -r $testroot/repo-clone
355 if [ $ret -ne 0 ]; then
356 echo "got fetch command failed unexpectedly" >&2
357 test_done "$testroot" "$ret"
361 got ref -l -r $testroot/repo-clone > $testroot/stdout
363 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
364 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
365 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
366 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
367 >> $testroot/stdout.expected
368 echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
369 echo "refs/remotes/origin/master: $commit_id" \
370 >> $testroot/stdout.expected
371 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
372 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
374 cmp -s $testroot/stdout $testroot/stdout.expected
376 if [ $ret -ne 0 ]; then
377 diff -u $testroot/stdout.expected $testroot/stdout
379 test_done "$testroot" "$ret"
382 test_fetch_empty_packfile() {
383 local testroot=`test_init fetch_empty_packfile`
384 local testurl=ssh://127.0.0.1/$testroot
385 local commit_id=`git_show_head $testroot/repo`
387 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
388 local tag_id=`got ref -r $testroot/repo -l \
389 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
391 got clone -q $testurl/repo $testroot/repo-clone
393 if [ $ret -ne 0 ]; then
394 echo "got clone command failed unexpectedly" >&2
395 test_done "$testroot" "$ret"
399 got branch -r $testroot/repo -c $commit_id foo
400 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
402 got ref -l -r $testroot/repo-clone > $testroot/stdout
404 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
405 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
406 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
407 >> $testroot/stdout.expected
408 echo "refs/remotes/origin/master: $commit_id" \
409 >> $testroot/stdout.expected
410 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
411 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
413 cmp -s $testroot/stdout $testroot/stdout.expected
415 if [ $ret -ne 0 ]; then
416 diff -u $testroot/stdout.expected $testroot/stdout
417 test_done "$testroot" "$ret"
421 got fetch -q -a -r $testroot/repo-clone
423 if [ $ret -ne 0 ]; then
424 echo "got fetch command failed unexpectedly" >&2
425 test_done "$testroot" "$ret"
429 got ref -l -r $testroot/repo-clone > $testroot/stdout
431 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
432 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
433 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
434 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
435 >> $testroot/stdout.expected
436 echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
437 echo "refs/remotes/origin/master: $commit_id" \
438 >> $testroot/stdout.expected
439 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
440 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
442 cmp -s $testroot/stdout $testroot/stdout.expected
444 if [ $ret -ne 0 ]; then
445 diff -u $testroot/stdout.expected $testroot/stdout
447 test_done "$testroot" "$ret"
450 test_fetch_delete_branch() {
451 local testroot=`test_init fetch_delete_branch`
452 local testurl=ssh://127.0.0.1/$testroot
453 local commit_id=`git_show_head $testroot/repo`
456 got branch -r $testroot/repo -c $commit_id foo
457 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
458 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
459 local tag_id=`got ref -r $testroot/repo -l \
460 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
462 got clone -a -q $testurl/repo $testroot/repo-clone
464 if [ $ret -ne 0 ]; then
465 echo "got clone command failed unexpectedly" >&2
466 test_done "$testroot" "$ret"
470 got ref -l -r $testroot/repo-clone > $testroot/stdout
472 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
473 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
474 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
475 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
476 >> $testroot/stdout.expected
477 echo "refs/remotes/origin/foo: $commit_id" \
478 >> $testroot/stdout.expected
479 echo "refs/remotes/origin/master: $commit_id" \
480 >> $testroot/stdout.expected
481 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
482 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
484 cmp -s $testroot/stdout $testroot/stdout.expected
486 if [ $ret -ne 0 ]; then
487 diff -u $testroot/stdout.expected $testroot/stdout
488 test_done "$testroot" "$ret"
492 got branch -r $testroot/repo -d foo >/dev/null
494 got fetch -q -r $testroot/repo-clone
496 if [ $ret -ne 0 ]; then
497 echo "got fetch command failed unexpectedly" >&2
498 test_done "$testroot" "$ret"
502 got ref -l -r $testroot/repo-clone > $testroot/stdout
504 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
505 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
506 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
507 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
508 >> $testroot/stdout.expected
509 echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
510 echo "refs/remotes/origin/master: $commit_id" \
511 >> $testroot/stdout.expected
512 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
513 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
515 cmp -s $testroot/stdout $testroot/stdout.expected
517 if [ $ret -ne 0 ]; then
518 diff -u $testroot/stdout.expected $testroot/stdout
519 test_done "$testroot" "$ret"
523 got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
525 if [ $ret -ne 0 ]; then
526 echo "got fetch command failed unexpectedly" >&2
527 test_done "$testroot" "$ret"
531 echo -n > $testroot/stdout.expected
533 cmp -s $testroot/stdout $testroot/stdout.expected
535 if [ $ret -ne 0 ]; then
536 diff -u $testroot/stdout.expected $testroot/stdout
537 test_done "$testroot" "$ret"
541 got ref -l -r $testroot/repo-clone > $testroot/stdout
543 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
544 # refs/heads/foo is now deleted
545 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
546 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
547 >> $testroot/stdout.expected
548 # refs/remotes/origin/foo is now deleted
549 echo "refs/remotes/origin/master: $commit_id" \
550 >> $testroot/stdout.expected
551 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
552 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
554 cmp -s $testroot/stdout $testroot/stdout.expected
556 if [ $ret -ne 0 ]; then
557 diff -u $testroot/stdout.expected $testroot/stdout
559 test_done "$testroot" "$ret"
563 test_fetch_delete_branch_mirror() {
564 local testroot=`test_init fetch_delete_branch_mirror`
565 local testurl=ssh://127.0.0.1/$testroot
566 local commit_id=`git_show_head $testroot/repo`
568 got branch -r $testroot/repo -c $commit_id foo
569 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
570 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
571 local tag_id=`got ref -r $testroot/repo -l \
572 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
574 got clone -a -m -q $testurl/repo $testroot/repo-clone
576 if [ $ret -ne 0 ]; then
577 echo "got clone command failed unexpectedly" >&2
578 test_done "$testroot" "$ret"
582 got ref -l -r $testroot/repo-clone > $testroot/stdout
584 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
585 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
586 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
587 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
588 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
590 cmp -s $testroot/stdout $testroot/stdout.expected
592 if [ $ret -ne 0 ]; then
593 diff -u $testroot/stdout.expected $testroot/stdout
594 test_done "$testroot" "$ret"
598 got branch -r $testroot/repo -d foo >/dev/null
600 got fetch -q -r $testroot/repo-clone
602 if [ $ret -ne 0 ]; then
603 echo "got fetch command failed unexpectedly" >&2
604 test_done "$testroot" "$ret"
608 got ref -l -r $testroot/repo-clone > $testroot/stdout
610 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
611 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
612 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
613 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
614 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
616 cmp -s $testroot/stdout $testroot/stdout.expected
618 if [ $ret -ne 0 ]; then
619 diff -u $testroot/stdout.expected $testroot/stdout
620 test_done "$testroot" "$ret"
624 got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
626 if [ $ret -ne 0 ]; then
627 echo "got fetch command failed unexpectedly" >&2
628 test_done "$testroot" "$ret"
632 echo -n > $testroot/stdout.expected
634 cmp -s $testroot/stdout $testroot/stdout.expected
636 if [ $ret -ne 0 ]; then
637 diff -u $testroot/stdout.expected $testroot/stdout
638 test_done "$testroot" "$ret"
642 got ref -l -r $testroot/repo-clone > $testroot/stdout
644 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
645 # refs/heads/foo is now deleted
646 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
647 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
648 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
650 cmp -s $testroot/stdout $testroot/stdout.expected
652 if [ $ret -ne 0 ]; then
653 diff -u $testroot/stdout.expected $testroot/stdout
655 test_done "$testroot" "$ret"
659 test_fetch_update_tag() {
660 local testroot=`test_init fetch_update_tag`
661 local testurl=ssh://127.0.0.1/$testroot
662 local commit_id=`git_show_head $testroot/repo`
665 got branch -r $testroot/repo -c $commit_id foo
666 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
667 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
668 local tag_id=`got ref -r $testroot/repo -l \
669 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
671 got clone -a -q $testurl/repo $testroot/repo-clone
673 if [ $ret -ne 0 ]; then
674 echo "got clone command failed unexpectedly" >&2
675 test_done "$testroot" "$ret"
679 echo "modified alpha on master" > $testroot/repo/alpha
680 git_commit $testroot/repo -m "modified alpha"
681 local commit_id2=`git_show_head $testroot/repo`
683 got ref -r $testroot/repo -d "refs/tags/1.0" >/dev/null
684 got tag -r $testroot/repo -c $commit_id2 -m tag "1.0" >/dev/null
685 local tag_id2=`got ref -r $testroot/repo -l \
686 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
688 got ref -l -r $testroot/repo-clone > $testroot/stdout
690 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
691 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
692 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
693 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
694 >> $testroot/stdout.expected
695 echo "refs/remotes/origin/foo: $commit_id" \
696 >> $testroot/stdout.expected
697 echo "refs/remotes/origin/master: $commit_id" \
698 >> $testroot/stdout.expected
699 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
700 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
702 cmp -s $testroot/stdout $testroot/stdout.expected
704 if [ $ret -ne 0 ]; then
705 diff -u $testroot/stdout.expected $testroot/stdout
706 test_done "$testroot" "$ret"
710 got fetch -a -q -r $testroot/repo-clone
712 if [ $ret -ne 0 ]; then
713 echo "got fetch command failed unexpectedly" >&2
714 test_done "$testroot" "$ret"
718 got ref -l -r $testroot/repo-clone > $testroot/stdout
720 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
721 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
722 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
723 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
724 >> $testroot/stdout.expected
725 echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
726 echo "refs/remotes/origin/master: $commit_id2" \
727 >> $testroot/stdout.expected
728 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
729 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
731 cmp -s $testroot/stdout $testroot/stdout.expected
733 if [ $ret -ne 0 ]; then
734 diff -u $testroot/stdout.expected $testroot/stdout
735 test_done "$testroot" "$ret"
739 got fetch -r $testroot/repo-clone 2> $testroot/stderr | \
740 tail -n 1 > $testroot/stdout
742 if [ $ret -ne 0 ]; then
743 echo "got fetch command failed unexpectedly" >&2
744 test_done "$testroot" "$ret"
748 echo "Rejecting update of existing tag refs/tags/1.0: $tag_id2" \
749 > $testroot/stdout.expected
751 cmp -s $testroot/stdout $testroot/stdout.expected
753 if [ $ret -ne 0 ]; then
754 diff -u $testroot/stdout.expected $testroot/stdout
755 test_done "$testroot" "$ret"
759 got ref -l -r $testroot/repo-clone > $testroot/stdout
761 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
762 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
763 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
764 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
765 >> $testroot/stdout.expected
766 echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
767 echo "refs/remotes/origin/master: $commit_id2" \
768 >> $testroot/stdout.expected
769 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
770 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
772 cmp -s $testroot/stdout $testroot/stdout.expected
774 if [ $ret -ne 0 ]; then
775 diff -u $testroot/stdout.expected $testroot/stdout
776 test_done "$testroot" "$ret"
780 got fetch -q -t -r $testroot/repo-clone > $testroot/stdout
782 if [ $ret -ne 0 ]; then
783 echo "got fetch command failed unexpectedly" >&2
784 test_done "$testroot" "$ret"
788 echo -n > $testroot/stdout.expected
790 cmp -s $testroot/stdout $testroot/stdout.expected
792 if [ $ret -ne 0 ]; then
793 diff -u $testroot/stdout.expected $testroot/stdout
794 test_done "$testroot" "$ret"
798 got ref -l -r $testroot/repo-clone > $testroot/stdout
800 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
801 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
802 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
803 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
804 >> $testroot/stdout.expected
805 echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
806 echo "refs/remotes/origin/master: $commit_id2" \
807 >> $testroot/stdout.expected
808 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
809 echo "refs/tags/1.0: $tag_id2" >> $testroot/stdout.expected
811 cmp -s $testroot/stdout $testroot/stdout.expected
813 if [ $ret -ne 0 ]; then
814 diff -u $testroot/stdout.expected $testroot/stdout
816 test_done "$testroot" "$ret"
819 test_fetch_reference() {
820 local testroot=`test_init fetch_reference`
821 local testurl=ssh://127.0.0.1/$testroot
822 local commit_id=`git_show_head $testroot/repo`
824 got clone -q $testurl/repo $testroot/repo-clone
826 if [ $ret -ne 0 ]; then
827 echo "got clone command failed unexpectedly" >&2
828 test_done "$testroot" "$ret"
832 got branch -r $testroot/repo -c $commit_id foo
833 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
834 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
835 local tag_id=`got ref -r $testroot/repo -l \
836 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
838 echo "modified alpha on master" > $testroot/repo/alpha
839 git_commit $testroot/repo -m "modified alpha"
840 local commit_id2=`git_show_head $testroot/repo`
842 (cd $testroot/repo && git checkout -q foo)
843 echo "modified alpha on foo" > $testroot/repo/alpha
844 git_commit $testroot/repo -m "modified alpha"
845 local commit_id3=`git_show_head $testroot/repo`
846 (cd $testroot/repo && git checkout -q master)
848 got fetch -q -r $testroot/repo-clone -R refs/remotes/origin/main \
849 > $testroot/stdout 2> $testroot/stderr
851 if [ $ret -eq 0 ]; then
852 echo "got fetch command succeeded unexpectedly" >&2
853 test_done "$testroot" "1"
857 echo -n > $testroot/stdout.expected
859 cmp -s $testroot/stdout $testroot/stdout.expected
861 if [ $ret -ne 0 ]; then
862 diff -u $testroot/stdout.expected $testroot/stdout
863 test_done "$testroot" "$ret"
867 echo "got: refs/remotes/origin/main: reference cannot be fetched" \
868 > $testroot/stderr.expected
870 cmp -s $testroot/stderr $testroot/stderr.expected
872 if [ $ret -ne 0 ]; then
873 diff -u $testroot/stderr.expected $testroot/stderr
874 test_done "$testroot" "$ret"
878 got fetch -q -r $testroot/repo-clone -R refs/hoo
880 if [ $ret -ne 0 ]; then
881 echo "got fetch command failed unexpectedly" >&2
882 test_done "$testroot" "$ret"
886 got ref -l -r $testroot/repo-clone > $testroot/stdout
888 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
889 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
890 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
891 >> $testroot/stdout.expected
892 echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
893 >> $testroot/stdout.expected
894 echo "refs/remotes/origin/master: $commit_id2" \
895 >> $testroot/stdout.expected
896 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
898 cmp -s $testroot/stdout $testroot/stdout.expected
900 if [ $ret -ne 0 ]; then
901 diff -u $testroot/stdout.expected $testroot/stdout
903 test_done "$testroot" "$ret"
907 test_fetch_replace_symref() {
908 local testroot=`test_init fetch_replace_symref`
909 local testurl=ssh://127.0.0.1/$testroot
910 local commit_id=`git_show_head $testroot/repo`
912 got clone -m -q $testurl/repo $testroot/repo-clone
914 if [ $ret -ne 0 ]; then
915 echo "got clone command failed unexpectedly" >&2
916 test_done "$testroot" "$ret"
920 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
921 got ref -r $testroot/repo-clone -s refs/heads/master refs/hoo/boo/zoo
923 got ref -l -r $testroot/repo-clone > $testroot/stdout
925 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
926 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
927 echo "refs/hoo/boo/zoo: refs/heads/master" >> $testroot/stdout.expected
929 cmp -s $testroot/stdout $testroot/stdout.expected
931 if [ $ret -ne 0 ]; then
932 diff -u $testroot/stdout.expected $testroot/stdout
933 test_done "$testroot" "$ret"
937 got fetch -r $testroot/repo-clone -R refs/hoo \
938 2> $testroot/stderr | grep ^Replacing > $testroot/stdout
940 if [ $ret -ne 0 ]; then
941 echo "got fetch command failed unexpectedly" >&2
942 test_done "$testroot" "$ret"
946 echo "Replacing reference refs/hoo/boo/zoo: refs/heads/master" \
947 > $testroot/stdout.expected
949 cmp -s $testroot/stdout $testroot/stdout.expected
951 if [ $ret -ne 0 ]; then
952 diff -u $testroot/stdout.expected $testroot/stdout
953 test_done "$testroot" "$ret"
957 got ref -l -r $testroot/repo-clone > $testroot/stdout
959 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
960 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
961 echo "refs/hoo/boo/zoo: $commit_id" >> $testroot/stdout.expected
963 cmp -s $testroot/stdout $testroot/stdout.expected
965 if [ $ret -ne 0 ]; then
966 diff -u $testroot/stdout.expected $testroot/stdout
968 test_done "$testroot" "$ret"
972 test_fetch_update_headref() {
973 local testroot=`test_init fetch_update_headref`
974 local testurl=ssh://127.0.0.1/$testroot
975 local commit_id=`git_show_head $testroot/repo`
977 got clone -q $testurl/repo $testroot/repo-clone
979 if [ $ret -ne 0 ]; then
980 echo "got clone command failed unexpectedly" >&2
981 test_done "$testroot" "$ret"
985 got ref -l -r $testroot/repo-clone > $testroot/stdout
987 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
988 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
989 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
990 >> $testroot/stdout.expected
991 echo "refs/remotes/origin/master: $commit_id" \
992 >> $testroot/stdout.expected
994 cmp -s $testroot/stdout $testroot/stdout.expected
996 if [ $ret -ne 0 ]; then
997 diff -u $testroot/stdout.expected $testroot/stdout
998 test_done "$testroot" "$ret"
1002 got ref -r $testroot/repo -c refs/heads/master refs/heads/foo
1003 got ref -r $testroot/repo -s refs/heads/foo HEAD
1004 got ref -l -r $testroot/repo > $testroot/stdout
1006 echo "HEAD: refs/heads/foo" > $testroot/stdout.expected
1007 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1008 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1010 cmp -s $testroot/stdout $testroot/stdout.expected
1012 if [ $ret -ne 0 ]; then
1013 diff -u $testroot/stdout.expected $testroot/stdout
1014 test_done "$testroot" "$ret"
1018 got fetch -q -r $testroot/repo-clone
1020 got ref -l -r $testroot/repo-clone > $testroot/stdout
1022 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1023 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1024 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1025 >> $testroot/stdout.expected
1026 echo "refs/remotes/origin/master: $commit_id" \
1027 >> $testroot/stdout.expected
1029 cmp -s $testroot/stdout $testroot/stdout.expected
1031 if [ $ret -ne 0 ]; then
1032 diff -u $testroot/stdout.expected $testroot/stdout
1033 test_done "$testroot" "$ret"
1037 got fetch -q -r $testroot/repo-clone -a
1039 got ref -l -r $testroot/repo-clone > $testroot/stdout
1041 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1042 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1043 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1044 echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
1045 >> $testroot/stdout.expected
1046 echo "refs/remotes/origin/foo: $commit_id" \
1047 >> $testroot/stdout.expected
1048 echo "refs/remotes/origin/master: $commit_id" \
1049 >> $testroot/stdout.expected
1051 cmp -s $testroot/stdout $testroot/stdout.expected
1053 if [ $ret -ne 0 ]; then
1054 diff -u $testroot/stdout.expected $testroot/stdout
1056 test_done "$testroot" "$ret"
1059 test_fetch_headref_deleted_locally() {
1060 local testroot=`test_init fetch_headref_deleted_locally`
1061 local testurl=ssh://127.0.0.1/$testroot
1062 local commit_id=`git_show_head $testroot/repo`
1064 got clone -q $testurl/repo $testroot/repo-clone
1066 if [ $ret -ne 0 ]; then
1067 echo "got clone command failed unexpectedly" >&2
1068 test_done "$testroot" "$ret"
1072 got ref -l -r $testroot/repo-clone > $testroot/stdout
1074 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1075 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1076 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1077 >> $testroot/stdout.expected
1078 echo "refs/remotes/origin/master: $commit_id" \
1079 >> $testroot/stdout.expected
1081 cmp -s $testroot/stdout $testroot/stdout.expected
1083 if [ $ret -ne 0 ]; then
1084 diff -u $testroot/stdout.expected $testroot/stdout
1085 test_done "$testroot" "$ret"
1089 got ref -r $testroot/repo-clone -d refs/remotes/origin/HEAD > /dev/null
1091 got fetch -q -r $testroot/repo-clone
1093 if [ $ret -ne 0 ]; then
1094 echo "got fetch command failed unexpectedly" >&2
1095 test_done "$testroot" "$ret"
1098 got ref -l -r $testroot/repo-clone > $testroot/stdout
1100 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1101 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1102 # refs/remotes/origin/HEAD has been restored:
1103 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1104 >> $testroot/stdout.expected
1105 echo "refs/remotes/origin/master: $commit_id" \
1106 >> $testroot/stdout.expected
1108 cmp -s $testroot/stdout $testroot/stdout.expected
1110 if [ $ret -ne 0 ]; then
1111 diff -u $testroot/stdout.expected $testroot/stdout
1113 test_done "$testroot" "$ret"
1116 test_fetch_gotconfig_remote_repo() {
1117 local testroot=`test_init fetch_gotconfig_remote_repo`
1118 local testurl=ssh://127.0.0.1/$testroot
1119 local commit_id=`git_show_head $testroot/repo`
1121 got branch -r $testroot/repo -c $commit_id foo
1122 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
1123 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
1125 got clone -q $testurl/repo $testroot/repo-clone
1127 if [ $ret -ne 0 ]; then
1128 echo "got clone command failed unexpectedly" >&2
1129 test_done "$testroot" "$ret"
1133 cat > $testroot/repo-clone/got.conf <<EOF
1137 repository "$testroot/repo"
1143 repository "$testroot/does-not-exist"
1146 echo "got: nonexistent: remote repository not found" \
1147 > $testroot/stderr.expected
1148 (cd $testroot/repo-clone && got fetch -q nonexistent \
1149 > $testroot/stdout 2> $testroot/stderr)
1151 if [ $ret -eq 0 ]; then
1152 echo "got fetch command succeeded unexpectedly" >&2
1153 diff -u $testroot/stderr.expected $testroot/stderr
1154 test_done "$testroot" "1"
1158 (cd $testroot/repo-clone && got fetch -q -l foobar \
1161 if [ $ret -ne 0 ]; then
1162 echo "got fetch command failed unexpectedly" >&2
1163 test_done "$testroot" "$ret"
1167 got ref -l -r $testroot/repo > $testroot/stdout.expected
1169 cmp -s $testroot/stdout $testroot/stdout.expected
1171 if [ $ret -ne 0 ]; then
1172 diff -u $testroot/stdout.expected $testroot/stdout
1173 test_done "$testroot" "$ret"
1177 got checkout $testroot/repo $testroot/wt > /dev/null
1179 cat > $testroot/wt/.got/got.conf <<EOF
1183 repository "$testroot/repo"
1186 (cd $testroot/wt && got fetch -q -l barbaz > $testroot/stdout)
1188 if [ $ret -ne 0 ]; then
1189 echo "got fetch command failed unexpectedly" >&2
1190 test_done "$testroot" "$ret"
1194 got ref -l -r $testroot/repo > $testroot/stdout.expected
1196 cmp -s $testroot/stdout $testroot/stdout.expected
1198 if [ $ret -ne 0 ]; then
1199 diff -u $testroot/stdout.expected $testroot/stdout
1200 test_done "$testroot" "$ret"
1204 cat > $testroot/repo-clone/got.conf <<EOF
1208 repository "$testroot/repo"
1210 reference { "hoo/boo/zoo" }
1213 (cd $testroot/repo-clone && got fetch -q > $testroot/stdout)
1215 local tag_id=`got ref -r $testroot/repo -l \
1216 | grep "^refs/tags/1.0" | tr -d ' ' | cut -d: -f2`
1217 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1218 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1219 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1220 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1221 >> $testroot/stdout.expected
1222 echo "refs/remotes/origin/foo: $commit_id" \
1223 >> $testroot/stdout.expected
1224 echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
1225 >> $testroot/stdout.expected
1226 echo "refs/remotes/origin/master: $commit_id" \
1227 >> $testroot/stdout.expected
1228 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1230 got ref -l -r $testroot/repo-clone > $testroot/stdout
1232 cmp -s $testroot/stdout $testroot/stdout.expected
1234 if [ $ret -ne 0 ]; then
1235 diff -u $testroot/stdout.expected $testroot/stdout
1237 test_done "$testroot" "$ret"
1240 test_fetch_delete_remote_refs() {
1241 local testroot=`test_init fetch_delete_remote_refs`
1242 local testurl=ssh://127.0.0.1/$testroot
1243 local commit_id=`git_show_head $testroot/repo`
1245 got clone -q $testurl/repo $testroot/repo-clone
1247 if [ $ret -ne 0 ]; then
1248 echo "got clone command failed unexpectedly" >&2
1249 test_done "$testroot" "$ret"
1253 got ref -l -r $testroot/repo-clone > $testroot/stdout
1255 if [ $ret -ne 0 ]; then
1256 echo "got ref command failed unexpectedly" >&2
1257 test_done "$testroot" "$ret"
1261 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1262 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1263 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1264 >> $testroot/stdout.expected
1265 echo "refs/remotes/origin/master: $commit_id" \
1266 >> $testroot/stdout.expected
1268 cmp -s $testroot/stdout $testroot/stdout.expected
1270 if [ $ret -ne 0 ]; then
1271 diff -u $testroot/stdout.expected $testroot/stdout
1272 test_done "$testroot" "$ret"
1276 got fetch -q -r $testroot/repo-clone -X > $testroot/stdout \
1279 if [ $ret -eq 0 ]; then
1280 echo "got fetch command succeeded unexpectedly" >&2
1281 test_done "$testroot" "$ret"
1285 echo "got: -X option requires a remote name" > $testroot/stderr.expected
1286 cmp -s $testroot/stderr $testroot/stderr.expected
1288 if [ $ret -ne 0 ]; then
1289 diff -u $testroot/stderr.expected $testroot/stderr
1290 test_done "$testroot" "$ret"
1294 got fetch -q -r $testroot/repo-clone -X origin > $testroot/stdout \
1297 if [ $ret -ne 0 ]; then
1298 echo "got fetch command failed unexpectedly" >&2
1299 test_done "$testroot" "$ret"
1303 echo -n "Deleted refs/remotes/origin/HEAD: " > $testroot/stdout.expected
1304 echo "refs/remotes/origin/master" >> $testroot/stdout.expected
1305 echo "Deleted refs/remotes/origin/master: $commit_id" \
1306 >> $testroot/stdout.expected
1308 cmp -s $testroot/stdout $testroot/stdout.expected
1310 if [ $ret -ne 0 ]; then
1311 diff -u $testroot/stdout.expected $testroot/stdout
1312 test_done "$testroot" "$ret"
1316 got ref -l -r $testroot/repo-clone > $testroot/stdout
1318 if [ $ret -ne 0 ]; then
1319 echo "got ref command failed unexpectedly" >&2
1320 test_done "$testroot" "$ret"
1324 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1325 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1327 cmp -s $testroot/stdout $testroot/stdout.expected
1329 if [ $ret -ne 0 ]; then
1330 diff -u $testroot/stdout.expected $testroot/stdout
1332 test_done "$testroot" "$ret"
1337 run_test test_fetch_basic
1338 run_test test_fetch_list
1339 run_test test_fetch_branch
1340 run_test test_fetch_all
1341 run_test test_fetch_empty_packfile
1342 run_test test_fetch_delete_branch
1343 run_test test_fetch_delete_branch_mirror
1344 run_test test_fetch_update_tag
1345 run_test test_fetch_reference
1346 run_test test_fetch_replace_symref
1347 run_test test_fetch_update_headref
1348 run_test test_fetch_headref_deleted_locally
1349 run_test test_fetch_gotconfig_remote_repo
1350 run_test test_fetch_delete_remote_refs