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 # foo is now the default HEAD branch in $testroot/repo and should be
192 # fetched as the clone's remote HEAD symref target no longer matches
193 got fetch -q -r $testroot/repo-clone > $testroot/stdout
195 if [ $ret -ne 0 ]; then
196 echo "got fetch command failed unexpectedly" >&2
197 test_done "$testroot" "$ret"
201 echo -n > $testroot/stdout.expected
203 cmp -s $testroot/stdout $testroot/stdout.expected
205 if [ $ret -ne 0 ]; then
206 diff -u $testroot/stdout.expected $testroot/stdout
207 test_done "$testroot" "$ret"
211 got ref -l -r $testroot/repo-clone > $testroot/stdout
213 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
214 echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
215 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
216 echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
217 >> $testroot/stdout.expected
218 echo "refs/remotes/origin/foo: $commit_id3" \
219 >> $testroot/stdout.expected
220 echo "refs/remotes/origin/master: $commit_id2" \
221 >> $testroot/stdout.expected
222 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
223 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
225 cmp -s $testroot/stdout $testroot/stdout.expected
227 if [ $ret -ne 0 ]; then
228 diff -u $testroot/stdout.expected $testroot/stdout
229 test_done "$testroot" "$ret"
233 # fetch branch foo via command-line switch
234 got fetch -q -r $testroot/repo-clone -b foo > $testroot/stdout
236 if [ $ret -ne 0 ]; then
237 echo "got fetch command failed unexpectedly" >&2
238 test_done "$testroot" "$ret"
242 echo -n > $testroot/stdout.expected
244 cmp -s $testroot/stdout $testroot/stdout.expected
246 if [ $ret -ne 0 ]; then
247 diff -u $testroot/stdout.expected $testroot/stdout
248 test_done "$testroot" "$ret"
252 got ref -l -r $testroot/repo-clone > $testroot/stdout
254 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
255 echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
256 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
257 echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
258 >> $testroot/stdout.expected
259 echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
260 echo "refs/remotes/origin/master: $commit_id2" \
261 >> $testroot/stdout.expected
262 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
263 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
265 cmp -s $testroot/stdout $testroot/stdout.expected
267 if [ $ret -ne 0 ]; then
268 diff -u $testroot/stdout.expected $testroot/stdout
269 test_done "$testroot" "$ret"
273 # got.conf tells us to fetch the 'master' branch by default
274 got fetch -q -r $testroot/repo-clone > $testroot/stdout
276 if [ $ret -ne 0 ]; then
277 echo "got fetch command failed unexpectedly" >&2
278 test_done "$testroot" "$ret"
282 echo -n > $testroot/stdout.expected
284 cmp -s $testroot/stdout $testroot/stdout.expected
286 if [ $ret -ne 0 ]; then
287 diff -u $testroot/stdout.expected $testroot/stdout
288 test_done "$testroot" "$ret"
292 got ref -l -r $testroot/repo-clone > $testroot/stdout
294 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
295 echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
296 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
297 echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
298 >> $testroot/stdout.expected
299 echo "refs/remotes/origin/foo: $commit_id3" >> $testroot/stdout.expected
300 echo "refs/remotes/origin/master: $commit_id2" \
301 >> $testroot/stdout.expected
302 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
303 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
305 cmp -s $testroot/stdout $testroot/stdout.expected
307 if [ $ret -ne 0 ]; then
308 diff -u $testroot/stdout.expected $testroot/stdout
309 test_done "$testroot" "$ret"
313 echo "modified beta on foo" > $testroot/repo/beta
314 git_commit $testroot/repo -m "modified beta"
315 local commit_id4=`git_show_head $testroot/repo`
317 # set the default HEAD branch back to master
318 (cd $testroot/repo && git checkout -q master)
320 got checkout -b foo $testroot/repo-clone $testroot/wt > /dev/null
322 # fetch new commits on branch 'foo', implicitly obtaining the
323 # branch name from a work tree
324 (cd $testroot/wt && got fetch -q > $testroot/stdout)
326 echo -n > $testroot/stdout.expected
328 cmp -s $testroot/stdout $testroot/stdout.expected
330 if [ $ret -ne 0 ]; then
331 diff -u $testroot/stdout.expected $testroot/stdout
332 test_done "$testroot" "$ret"
336 wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
337 cut -d ':' -f 2 | tr -d ' ')`
339 got ref -l -r $testroot/repo-clone > $testroot/stdout
341 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
342 echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \
343 >> $testroot/stdout.expected
344 echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
345 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
346 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
347 >> $testroot/stdout.expected
348 echo "refs/remotes/origin/foo: $commit_id4" >> $testroot/stdout.expected
349 echo "refs/remotes/origin/master: $commit_id2" \
350 >> $testroot/stdout.expected
351 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
352 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
354 cmp -s $testroot/stdout $testroot/stdout.expected
356 if [ $ret -ne 0 ]; then
357 diff -u $testroot/stdout.expected $testroot/stdout
358 test_done "$testroot" "$ret"
362 # remove default branch information from got.conf
363 ed -s $testroot/repo-clone/got.conf <<-EOF
368 # make another change on 'foo' and fetch it without got.conf
369 (cd $testroot/repo && git checkout -q foo)
370 echo "modified beta on foo agan" > $testroot/repo/beta
371 git_commit $testroot/repo -m "modified beta"
372 local commit_id5=`git_show_head $testroot/repo`
373 (cd $testroot/repo && git checkout -q master)
375 # fetch new commits on branch 'foo', implicitly obtaining the
376 # branch name from a work tree
377 (cd $testroot/wt && got fetch -q > $testroot/stdout)
379 echo -n > $testroot/stdout.expected
381 cmp -s $testroot/stdout $testroot/stdout.expected
383 if [ $ret -ne 0 ]; then
384 diff -u $testroot/stdout.expected $testroot/stdout
385 test_done "$testroot" "$ret"
389 wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
390 cut -d ':' -f 2 | tr -d ' ')`
392 got ref -l -r $testroot/repo-clone > $testroot/stdout
394 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
395 echo "refs/got/worktree/base-$wt_uuid: $commit_id3" \
396 >> $testroot/stdout.expected
397 echo "refs/heads/foo: $commit_id3" >> $testroot/stdout.expected
398 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
399 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
400 >> $testroot/stdout.expected
401 echo "refs/remotes/origin/foo: $commit_id5" >> $testroot/stdout.expected
402 echo "refs/remotes/origin/master: $commit_id2" \
403 >> $testroot/stdout.expected
404 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
405 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
407 cmp -s $testroot/stdout $testroot/stdout.expected
409 if [ $ret -ne 0 ]; then
410 diff -u $testroot/stdout.expected $testroot/stdout
412 test_done "$testroot" "$ret"
416 local testroot=`test_init fetch_all`
417 local testurl=ssh://127.0.0.1/$testroot
418 local commit_id=`git_show_head $testroot/repo`
420 got clone -q $testurl/repo $testroot/repo-clone
422 if [ $ret -ne 0 ]; then
423 echo "got clone command failed unexpectedly" >&2
424 test_done "$testroot" "$ret"
428 got branch -r $testroot/repo -c $commit_id foo
429 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
430 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
431 local tag_id=`got ref -r $testroot/repo -l \
432 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
434 got ref -l -r $testroot/repo-clone > $testroot/stdout
436 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
437 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
438 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
439 >> $testroot/stdout.expected
440 echo "refs/remotes/origin/master: $commit_id" \
441 >> $testroot/stdout.expected
442 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
444 cmp -s $testroot/stdout $testroot/stdout.expected
446 if [ $ret -ne 0 ]; then
447 diff -u $testroot/stdout.expected $testroot/stdout
448 test_done "$testroot" "$ret"
452 got fetch -q -a -r $testroot/repo-clone
454 if [ $ret -ne 0 ]; then
455 echo "got fetch command failed unexpectedly" >&2
456 test_done "$testroot" "$ret"
460 got ref -l -r $testroot/repo-clone > $testroot/stdout
462 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
463 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
464 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
465 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
466 >> $testroot/stdout.expected
467 echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
468 echo "refs/remotes/origin/master: $commit_id" \
469 >> $testroot/stdout.expected
470 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
471 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
473 cmp -s $testroot/stdout $testroot/stdout.expected
475 if [ $ret -ne 0 ]; then
476 diff -u $testroot/stdout.expected $testroot/stdout
478 test_done "$testroot" "$ret"
481 test_fetch_empty_packfile() {
482 local testroot=`test_init fetch_empty_packfile`
483 local testurl=ssh://127.0.0.1/$testroot
484 local commit_id=`git_show_head $testroot/repo`
486 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
487 local tag_id=`got ref -r $testroot/repo -l \
488 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
490 got clone -q $testurl/repo $testroot/repo-clone
492 if [ $ret -ne 0 ]; then
493 echo "got clone command failed unexpectedly" >&2
494 test_done "$testroot" "$ret"
498 got branch -r $testroot/repo -c $commit_id foo
499 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
501 got ref -l -r $testroot/repo-clone > $testroot/stdout
503 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
504 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
505 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
506 >> $testroot/stdout.expected
507 echo "refs/remotes/origin/master: $commit_id" \
508 >> $testroot/stdout.expected
509 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
510 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
512 cmp -s $testroot/stdout $testroot/stdout.expected
514 if [ $ret -ne 0 ]; then
515 diff -u $testroot/stdout.expected $testroot/stdout
516 test_done "$testroot" "$ret"
520 got fetch -q -a -r $testroot/repo-clone
522 if [ $ret -ne 0 ]; then
523 echo "got fetch command failed unexpectedly" >&2
524 test_done "$testroot" "$ret"
528 got ref -l -r $testroot/repo-clone > $testroot/stdout
530 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
531 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
532 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
533 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
534 >> $testroot/stdout.expected
535 echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
536 echo "refs/remotes/origin/master: $commit_id" \
537 >> $testroot/stdout.expected
538 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
539 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
541 cmp -s $testroot/stdout $testroot/stdout.expected
543 if [ $ret -ne 0 ]; then
544 diff -u $testroot/stdout.expected $testroot/stdout
546 test_done "$testroot" "$ret"
549 test_fetch_delete_branch() {
550 local testroot=`test_init fetch_delete_branch`
551 local testurl=ssh://127.0.0.1/$testroot
552 local commit_id=`git_show_head $testroot/repo`
555 got branch -r $testroot/repo -c $commit_id foo
556 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
557 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
558 local tag_id=`got ref -r $testroot/repo -l \
559 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
561 got clone -a -q $testurl/repo $testroot/repo-clone
563 if [ $ret -ne 0 ]; then
564 echo "got clone command failed unexpectedly" >&2
565 test_done "$testroot" "$ret"
569 got ref -l -r $testroot/repo-clone > $testroot/stdout
571 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
572 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
573 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
574 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
575 >> $testroot/stdout.expected
576 echo "refs/remotes/origin/foo: $commit_id" \
577 >> $testroot/stdout.expected
578 echo "refs/remotes/origin/master: $commit_id" \
579 >> $testroot/stdout.expected
580 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
581 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
583 cmp -s $testroot/stdout $testroot/stdout.expected
585 if [ $ret -ne 0 ]; then
586 diff -u $testroot/stdout.expected $testroot/stdout
587 test_done "$testroot" "$ret"
591 got branch -r $testroot/repo -d foo >/dev/null
593 got fetch -q -r $testroot/repo-clone
595 if [ $ret -ne 0 ]; then
596 echo "got fetch command failed unexpectedly" >&2
597 test_done "$testroot" "$ret"
601 got ref -l -r $testroot/repo-clone > $testroot/stdout
603 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
604 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
605 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
606 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
607 >> $testroot/stdout.expected
608 echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
609 echo "refs/remotes/origin/master: $commit_id" \
610 >> $testroot/stdout.expected
611 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
612 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
614 cmp -s $testroot/stdout $testroot/stdout.expected
616 if [ $ret -ne 0 ]; then
617 diff -u $testroot/stdout.expected $testroot/stdout
618 test_done "$testroot" "$ret"
622 got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
624 if [ $ret -ne 0 ]; then
625 echo "got fetch command failed unexpectedly" >&2
626 test_done "$testroot" "$ret"
630 echo -n > $testroot/stdout.expected
632 cmp -s $testroot/stdout $testroot/stdout.expected
634 if [ $ret -ne 0 ]; then
635 diff -u $testroot/stdout.expected $testroot/stdout
636 test_done "$testroot" "$ret"
640 got ref -l -r $testroot/repo-clone > $testroot/stdout
642 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
643 # refs/heads/foo is now deleted
644 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
645 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
646 >> $testroot/stdout.expected
647 # refs/remotes/origin/foo is now deleted
648 echo "refs/remotes/origin/master: $commit_id" \
649 >> $testroot/stdout.expected
650 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
651 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
653 cmp -s $testroot/stdout $testroot/stdout.expected
655 if [ $ret -ne 0 ]; then
656 diff -u $testroot/stdout.expected $testroot/stdout
658 test_done "$testroot" "$ret"
662 test_fetch_delete_branch_mirror() {
663 local testroot=`test_init fetch_delete_branch_mirror`
664 local testurl=ssh://127.0.0.1/$testroot
665 local commit_id=`git_show_head $testroot/repo`
667 got branch -r $testroot/repo -c $commit_id foo
668 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
669 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
670 local tag_id=`got ref -r $testroot/repo -l \
671 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
673 got clone -a -m -q $testurl/repo $testroot/repo-clone
675 if [ $ret -ne 0 ]; then
676 echo "got clone command failed unexpectedly" >&2
677 test_done "$testroot" "$ret"
681 got ref -l -r $testroot/repo-clone > $testroot/stdout
683 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
684 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
685 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
686 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
687 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
689 cmp -s $testroot/stdout $testroot/stdout.expected
691 if [ $ret -ne 0 ]; then
692 diff -u $testroot/stdout.expected $testroot/stdout
693 test_done "$testroot" "$ret"
697 got branch -r $testroot/repo -d foo >/dev/null
699 got fetch -q -r $testroot/repo-clone
701 if [ $ret -ne 0 ]; then
702 echo "got fetch command failed unexpectedly" >&2
703 test_done "$testroot" "$ret"
707 got ref -l -r $testroot/repo-clone > $testroot/stdout
709 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
710 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
711 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
712 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
713 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
715 cmp -s $testroot/stdout $testroot/stdout.expected
717 if [ $ret -ne 0 ]; then
718 diff -u $testroot/stdout.expected $testroot/stdout
719 test_done "$testroot" "$ret"
723 got fetch -d -q -r $testroot/repo-clone > $testroot/stdout
725 if [ $ret -ne 0 ]; then
726 echo "got fetch command failed unexpectedly" >&2
727 test_done "$testroot" "$ret"
731 echo -n > $testroot/stdout.expected
733 cmp -s $testroot/stdout $testroot/stdout.expected
735 if [ $ret -ne 0 ]; then
736 diff -u $testroot/stdout.expected $testroot/stdout
737 test_done "$testroot" "$ret"
741 got ref -l -r $testroot/repo-clone > $testroot/stdout
743 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
744 # refs/heads/foo is now deleted
745 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
746 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
747 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
749 cmp -s $testroot/stdout $testroot/stdout.expected
751 if [ $ret -ne 0 ]; then
752 diff -u $testroot/stdout.expected $testroot/stdout
754 test_done "$testroot" "$ret"
758 test_fetch_update_tag() {
759 local testroot=`test_init fetch_update_tag`
760 local testurl=ssh://127.0.0.1/$testroot
761 local commit_id=`git_show_head $testroot/repo`
764 got branch -r $testroot/repo -c $commit_id foo
765 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
766 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
767 local tag_id=`got ref -r $testroot/repo -l \
768 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
770 got clone -a -q $testurl/repo $testroot/repo-clone
772 if [ $ret -ne 0 ]; then
773 echo "got clone command failed unexpectedly" >&2
774 test_done "$testroot" "$ret"
778 echo "modified alpha on master" > $testroot/repo/alpha
779 git_commit $testroot/repo -m "modified alpha"
780 local commit_id2=`git_show_head $testroot/repo`
782 got ref -r $testroot/repo -d "refs/tags/1.0" >/dev/null
783 got tag -r $testroot/repo -c $commit_id2 -m tag "1.0" >/dev/null
784 local tag_id2=`got ref -r $testroot/repo -l \
785 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
787 got ref -l -r $testroot/repo-clone > $testroot/stdout
789 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
790 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
791 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
792 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
793 >> $testroot/stdout.expected
794 echo "refs/remotes/origin/foo: $commit_id" \
795 >> $testroot/stdout.expected
796 echo "refs/remotes/origin/master: $commit_id" \
797 >> $testroot/stdout.expected
798 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
799 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
801 cmp -s $testroot/stdout $testroot/stdout.expected
803 if [ $ret -ne 0 ]; then
804 diff -u $testroot/stdout.expected $testroot/stdout
805 test_done "$testroot" "$ret"
809 got fetch -a -q -r $testroot/repo-clone
811 if [ $ret -ne 0 ]; then
812 echo "got fetch command failed unexpectedly" >&2
813 test_done "$testroot" "$ret"
817 got ref -l -r $testroot/repo-clone > $testroot/stdout
819 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
820 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
821 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
822 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
823 >> $testroot/stdout.expected
824 echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
825 echo "refs/remotes/origin/master: $commit_id2" \
826 >> $testroot/stdout.expected
827 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
828 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
830 cmp -s $testroot/stdout $testroot/stdout.expected
832 if [ $ret -ne 0 ]; then
833 diff -u $testroot/stdout.expected $testroot/stdout
834 test_done "$testroot" "$ret"
838 got fetch -r $testroot/repo-clone 2> $testroot/stderr | \
839 tail -n 1 > $testroot/stdout
841 if [ $ret -ne 0 ]; then
842 echo "got fetch command failed unexpectedly" >&2
843 test_done "$testroot" "$ret"
847 echo "Rejecting update of existing tag refs/tags/1.0: $tag_id2" \
848 > $testroot/stdout.expected
850 cmp -s $testroot/stdout $testroot/stdout.expected
852 if [ $ret -ne 0 ]; then
853 diff -u $testroot/stdout.expected $testroot/stdout
854 test_done "$testroot" "$ret"
858 got ref -l -r $testroot/repo-clone > $testroot/stdout
860 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
861 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
862 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
863 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
864 >> $testroot/stdout.expected
865 echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
866 echo "refs/remotes/origin/master: $commit_id2" \
867 >> $testroot/stdout.expected
868 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
869 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
871 cmp -s $testroot/stdout $testroot/stdout.expected
873 if [ $ret -ne 0 ]; then
874 diff -u $testroot/stdout.expected $testroot/stdout
875 test_done "$testroot" "$ret"
879 got fetch -q -t -r $testroot/repo-clone > $testroot/stdout
881 if [ $ret -ne 0 ]; then
882 echo "got fetch command failed unexpectedly" >&2
883 test_done "$testroot" "$ret"
887 echo -n > $testroot/stdout.expected
889 cmp -s $testroot/stdout $testroot/stdout.expected
891 if [ $ret -ne 0 ]; then
892 diff -u $testroot/stdout.expected $testroot/stdout
893 test_done "$testroot" "$ret"
897 got ref -l -r $testroot/repo-clone > $testroot/stdout
899 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
900 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
901 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
902 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
903 >> $testroot/stdout.expected
904 echo "refs/remotes/origin/foo: $commit_id" >> $testroot/stdout.expected
905 echo "refs/remotes/origin/master: $commit_id2" \
906 >> $testroot/stdout.expected
907 # refs/hoo/boo/zoo is missing because it is outside of refs/heads
908 echo "refs/tags/1.0: $tag_id2" >> $testroot/stdout.expected
910 cmp -s $testroot/stdout $testroot/stdout.expected
912 if [ $ret -ne 0 ]; then
913 diff -u $testroot/stdout.expected $testroot/stdout
915 test_done "$testroot" "$ret"
918 test_fetch_reference() {
919 local testroot=`test_init fetch_reference`
920 local testurl=ssh://127.0.0.1/$testroot
921 local commit_id=`git_show_head $testroot/repo`
923 got clone -q $testurl/repo $testroot/repo-clone
925 if [ $ret -ne 0 ]; then
926 echo "got clone command failed unexpectedly" >&2
927 test_done "$testroot" "$ret"
931 got branch -r $testroot/repo -c $commit_id foo
932 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
933 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
934 local tag_id=`got ref -r $testroot/repo -l \
935 | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
937 echo "modified alpha on master" > $testroot/repo/alpha
938 git_commit $testroot/repo -m "modified alpha"
939 local commit_id2=`git_show_head $testroot/repo`
941 (cd $testroot/repo && git checkout -q foo)
942 echo "modified alpha on foo" > $testroot/repo/alpha
943 git_commit $testroot/repo -m "modified alpha"
944 local commit_id3=`git_show_head $testroot/repo`
945 (cd $testroot/repo && git checkout -q master)
947 got fetch -q -r $testroot/repo-clone -R refs/remotes/origin/main \
948 > $testroot/stdout 2> $testroot/stderr
950 if [ $ret -eq 0 ]; then
951 echo "got fetch command succeeded unexpectedly" >&2
952 test_done "$testroot" "1"
956 echo -n > $testroot/stdout.expected
958 cmp -s $testroot/stdout $testroot/stdout.expected
960 if [ $ret -ne 0 ]; then
961 diff -u $testroot/stdout.expected $testroot/stdout
962 test_done "$testroot" "$ret"
966 echo "got: refs/remotes/origin/main: reference cannot be fetched" \
967 > $testroot/stderr.expected
969 cmp -s $testroot/stderr $testroot/stderr.expected
971 if [ $ret -ne 0 ]; then
972 diff -u $testroot/stderr.expected $testroot/stderr
973 test_done "$testroot" "$ret"
977 got fetch -q -r $testroot/repo-clone -R refs/hoo
979 if [ $ret -ne 0 ]; then
980 echo "got fetch 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/hoo/boo/zoo: $commit_id" \
992 >> $testroot/stdout.expected
993 echo "refs/remotes/origin/master: $commit_id2" \
994 >> $testroot/stdout.expected
995 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
997 cmp -s $testroot/stdout $testroot/stdout.expected
999 if [ $ret -ne 0 ]; then
1000 diff -u $testroot/stdout.expected $testroot/stdout
1002 test_done "$testroot" "$ret"
1006 test_fetch_replace_symref() {
1007 local testroot=`test_init fetch_replace_symref`
1008 local testurl=ssh://127.0.0.1/$testroot
1009 local commit_id=`git_show_head $testroot/repo`
1011 got clone -m -q $testurl/repo $testroot/repo-clone
1013 if [ $ret -ne 0 ]; then
1014 echo "got clone command failed unexpectedly" >&2
1015 test_done "$testroot" "$ret"
1019 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
1020 got ref -r $testroot/repo-clone -s refs/heads/master refs/hoo/boo/zoo
1022 got ref -l -r $testroot/repo-clone > $testroot/stdout
1024 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1025 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1026 echo "refs/hoo/boo/zoo: refs/heads/master" >> $testroot/stdout.expected
1028 cmp -s $testroot/stdout $testroot/stdout.expected
1030 if [ $ret -ne 0 ]; then
1031 diff -u $testroot/stdout.expected $testroot/stdout
1032 test_done "$testroot" "$ret"
1036 got fetch -r $testroot/repo-clone -R refs/hoo \
1037 2> $testroot/stderr | grep ^Replacing > $testroot/stdout
1039 if [ $ret -ne 0 ]; then
1040 echo "got fetch command failed unexpectedly" >&2
1041 test_done "$testroot" "$ret"
1045 echo "Replacing reference refs/hoo/boo/zoo: refs/heads/master" \
1046 > $testroot/stdout.expected
1048 cmp -s $testroot/stdout $testroot/stdout.expected
1050 if [ $ret -ne 0 ]; then
1051 diff -u $testroot/stdout.expected $testroot/stdout
1052 test_done "$testroot" "$ret"
1056 got ref -l -r $testroot/repo-clone > $testroot/stdout
1058 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1059 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1060 echo "refs/hoo/boo/zoo: $commit_id" >> $testroot/stdout.expected
1062 cmp -s $testroot/stdout $testroot/stdout.expected
1064 if [ $ret -ne 0 ]; then
1065 diff -u $testroot/stdout.expected $testroot/stdout
1067 test_done "$testroot" "$ret"
1071 test_fetch_update_headref() {
1072 local testroot=`test_init fetch_update_headref`
1073 local testurl=ssh://127.0.0.1/$testroot
1074 local commit_id=`git_show_head $testroot/repo`
1076 got clone -q $testurl/repo $testroot/repo-clone
1078 if [ $ret -ne 0 ]; then
1079 echo "got clone command failed unexpectedly" >&2
1080 test_done "$testroot" "$ret"
1084 got ref -l -r $testroot/repo-clone > $testroot/stdout
1086 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1087 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1088 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1089 >> $testroot/stdout.expected
1090 echo "refs/remotes/origin/master: $commit_id" \
1091 >> $testroot/stdout.expected
1093 cmp -s $testroot/stdout $testroot/stdout.expected
1095 if [ $ret -ne 0 ]; then
1096 diff -u $testroot/stdout.expected $testroot/stdout
1097 test_done "$testroot" "$ret"
1101 got ref -r $testroot/repo -c refs/heads/master refs/heads/foo
1102 got ref -r $testroot/repo -s refs/heads/foo HEAD
1103 got ref -l -r $testroot/repo > $testroot/stdout
1105 echo "HEAD: refs/heads/foo" > $testroot/stdout.expected
1106 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1107 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1109 cmp -s $testroot/stdout $testroot/stdout.expected
1111 if [ $ret -ne 0 ]; then
1112 diff -u $testroot/stdout.expected $testroot/stdout
1113 test_done "$testroot" "$ret"
1117 got fetch -q -r $testroot/repo-clone
1119 got ref -l -r $testroot/repo-clone > $testroot/stdout
1121 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1122 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1123 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1124 echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
1125 >> $testroot/stdout.expected
1126 echo "refs/remotes/origin/foo: $commit_id" \
1127 >> $testroot/stdout.expected
1128 echo "refs/remotes/origin/master: $commit_id" \
1129 >> $testroot/stdout.expected
1131 cmp -s $testroot/stdout $testroot/stdout.expected
1133 if [ $ret -ne 0 ]; then
1134 diff -u $testroot/stdout.expected $testroot/stdout
1135 test_done "$testroot" "$ret"
1139 got fetch -q -r $testroot/repo-clone -a
1141 got ref -l -r $testroot/repo-clone > $testroot/stdout
1143 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1144 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1145 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1146 echo "refs/remotes/origin/HEAD: refs/remotes/origin/foo" \
1147 >> $testroot/stdout.expected
1148 echo "refs/remotes/origin/foo: $commit_id" \
1149 >> $testroot/stdout.expected
1150 echo "refs/remotes/origin/master: $commit_id" \
1151 >> $testroot/stdout.expected
1153 cmp -s $testroot/stdout $testroot/stdout.expected
1155 if [ $ret -ne 0 ]; then
1156 diff -u $testroot/stdout.expected $testroot/stdout
1158 test_done "$testroot" "$ret"
1161 test_fetch_headref_deleted_locally() {
1162 local testroot=`test_init fetch_headref_deleted_locally`
1163 local testurl=ssh://127.0.0.1/$testroot
1164 local commit_id=`git_show_head $testroot/repo`
1166 got clone -q $testurl/repo $testroot/repo-clone
1168 if [ $ret -ne 0 ]; then
1169 echo "got clone command failed unexpectedly" >&2
1170 test_done "$testroot" "$ret"
1174 got ref -l -r $testroot/repo-clone > $testroot/stdout
1176 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1177 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1178 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1179 >> $testroot/stdout.expected
1180 echo "refs/remotes/origin/master: $commit_id" \
1181 >> $testroot/stdout.expected
1183 cmp -s $testroot/stdout $testroot/stdout.expected
1185 if [ $ret -ne 0 ]; then
1186 diff -u $testroot/stdout.expected $testroot/stdout
1187 test_done "$testroot" "$ret"
1191 got ref -r $testroot/repo-clone -d refs/remotes/origin/HEAD > /dev/null
1193 got fetch -q -r $testroot/repo-clone
1195 if [ $ret -ne 0 ]; then
1196 echo "got fetch command failed unexpectedly" >&2
1197 test_done "$testroot" "$ret"
1200 got ref -l -r $testroot/repo-clone > $testroot/stdout
1202 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1203 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1204 # refs/remotes/origin/HEAD has been restored:
1205 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1206 >> $testroot/stdout.expected
1207 echo "refs/remotes/origin/master: $commit_id" \
1208 >> $testroot/stdout.expected
1210 cmp -s $testroot/stdout $testroot/stdout.expected
1212 if [ $ret -ne 0 ]; then
1213 diff -u $testroot/stdout.expected $testroot/stdout
1215 test_done "$testroot" "$ret"
1218 test_fetch_gotconfig_remote_repo() {
1219 local testroot=`test_init fetch_gotconfig_remote_repo`
1220 local testurl=ssh://127.0.0.1/$testroot
1221 local commit_id=`git_show_head $testroot/repo`
1223 got branch -r $testroot/repo -c $commit_id foo
1224 got ref -r $testroot/repo -c $commit_id refs/hoo/boo/zoo
1225 got tag -r $testroot/repo -c $commit_id -m tag "1.0" >/dev/null
1227 got clone -q $testurl/repo $testroot/repo-clone
1229 if [ $ret -ne 0 ]; then
1230 echo "got clone command failed unexpectedly" >&2
1231 test_done "$testroot" "$ret"
1235 cat > $testroot/repo-clone/got.conf <<EOF
1239 repository "$testroot/repo"
1245 repository "$testroot/does-not-exist"
1248 echo "got: nonexistent: remote repository not found" \
1249 > $testroot/stderr.expected
1250 (cd $testroot/repo-clone && got fetch -q nonexistent \
1251 > $testroot/stdout 2> $testroot/stderr)
1253 if [ $ret -eq 0 ]; then
1254 echo "got fetch command succeeded unexpectedly" >&2
1255 diff -u $testroot/stderr.expected $testroot/stderr
1256 test_done "$testroot" "1"
1260 (cd $testroot/repo-clone && got fetch -q -l foobar \
1263 if [ $ret -ne 0 ]; then
1264 echo "got fetch command failed unexpectedly" >&2
1265 test_done "$testroot" "$ret"
1269 got ref -l -r $testroot/repo > $testroot/stdout.expected
1271 cmp -s $testroot/stdout $testroot/stdout.expected
1273 if [ $ret -ne 0 ]; then
1274 diff -u $testroot/stdout.expected $testroot/stdout
1275 test_done "$testroot" "$ret"
1279 got checkout $testroot/repo $testroot/wt > /dev/null
1281 cat > $testroot/wt/.got/got.conf <<EOF
1285 repository "$testroot/repo"
1288 (cd $testroot/wt && got fetch -q -l barbaz > $testroot/stdout)
1290 if [ $ret -ne 0 ]; then
1291 echo "got fetch command failed unexpectedly" >&2
1292 test_done "$testroot" "$ret"
1296 got ref -l -r $testroot/repo > $testroot/stdout.expected
1298 cmp -s $testroot/stdout $testroot/stdout.expected
1300 if [ $ret -ne 0 ]; then
1301 diff -u $testroot/stdout.expected $testroot/stdout
1302 test_done "$testroot" "$ret"
1306 cat > $testroot/repo-clone/got.conf <<EOF
1310 repository "$testroot/repo"
1312 reference { "hoo/boo/zoo" }
1315 (cd $testroot/repo-clone && got fetch -q > $testroot/stdout)
1317 local tag_id=`got ref -r $testroot/repo -l \
1318 | grep "^refs/tags/1.0" | tr -d ' ' | cut -d: -f2`
1319 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1320 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1321 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1322 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1323 >> $testroot/stdout.expected
1324 echo "refs/remotes/origin/foo: $commit_id" \
1325 >> $testroot/stdout.expected
1326 echo "refs/remotes/origin/hoo/boo/zoo: $commit_id" \
1327 >> $testroot/stdout.expected
1328 echo "refs/remotes/origin/master: $commit_id" \
1329 >> $testroot/stdout.expected
1330 echo "refs/tags/1.0: $tag_id" >> $testroot/stdout.expected
1332 got ref -l -r $testroot/repo-clone > $testroot/stdout
1334 cmp -s $testroot/stdout $testroot/stdout.expected
1336 if [ $ret -ne 0 ]; then
1337 diff -u $testroot/stdout.expected $testroot/stdout
1339 test_done "$testroot" "$ret"
1342 test_fetch_delete_remote_refs() {
1343 local testroot=`test_init fetch_delete_remote_refs`
1344 local testurl=ssh://127.0.0.1/$testroot
1345 local commit_id=`git_show_head $testroot/repo`
1347 got clone -q $testurl/repo $testroot/repo-clone
1349 if [ $ret -ne 0 ]; then
1350 echo "got clone command failed unexpectedly" >&2
1351 test_done "$testroot" "$ret"
1355 got ref -l -r $testroot/repo-clone > $testroot/stdout
1357 if [ $ret -ne 0 ]; then
1358 echo "got ref command failed unexpectedly" >&2
1359 test_done "$testroot" "$ret"
1363 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1364 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1365 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1366 >> $testroot/stdout.expected
1367 echo "refs/remotes/origin/master: $commit_id" \
1368 >> $testroot/stdout.expected
1370 cmp -s $testroot/stdout $testroot/stdout.expected
1372 if [ $ret -ne 0 ]; then
1373 diff -u $testroot/stdout.expected $testroot/stdout
1374 test_done "$testroot" "$ret"
1378 got fetch -q -r $testroot/repo-clone -X > $testroot/stdout \
1381 if [ $ret -eq 0 ]; then
1382 echo "got fetch command succeeded unexpectedly" >&2
1383 test_done "$testroot" "$ret"
1387 echo "got: -X option requires a remote name" > $testroot/stderr.expected
1388 cmp -s $testroot/stderr $testroot/stderr.expected
1390 if [ $ret -ne 0 ]; then
1391 diff -u $testroot/stderr.expected $testroot/stderr
1392 test_done "$testroot" "$ret"
1396 got fetch -q -r $testroot/repo-clone -X origin > $testroot/stdout \
1399 if [ $ret -ne 0 ]; then
1400 echo "got fetch command failed unexpectedly" >&2
1401 test_done "$testroot" "$ret"
1405 echo -n "Deleted refs/remotes/origin/HEAD: " > $testroot/stdout.expected
1406 echo "refs/remotes/origin/master" >> $testroot/stdout.expected
1407 echo "Deleted refs/remotes/origin/master: $commit_id" \
1408 >> $testroot/stdout.expected
1410 cmp -s $testroot/stdout $testroot/stdout.expected
1412 if [ $ret -ne 0 ]; then
1413 diff -u $testroot/stdout.expected $testroot/stdout
1414 test_done "$testroot" "$ret"
1418 got ref -l -r $testroot/repo-clone > $testroot/stdout
1420 if [ $ret -ne 0 ]; then
1421 echo "got ref command failed unexpectedly" >&2
1422 test_done "$testroot" "$ret"
1426 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1427 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1429 cmp -s $testroot/stdout $testroot/stdout.expected
1431 if [ $ret -ne 0 ]; then
1432 diff -u $testroot/stdout.expected $testroot/stdout
1434 test_done "$testroot" "$ret"
1437 test_fetch_honor_wt_conf_bflag() {
1438 local testroot=`test_init fetch_honor_wt_conf_bflag`
1439 local testurl=ssh://127.0.0.1/$testroot
1441 # server will have 'boo', 'hoo', and 'master'
1442 echo "modified alpha on master" > $testroot/repo/alpha
1443 git_commit $testroot/repo -m "modified alpha"
1444 local commit_id=`git_show_head $testroot/repo`
1446 got branch -r $testroot/repo -c $commit_id boo
1447 (cd $testroot/repo && git checkout -q boo)
1448 echo "modified beta on boo" > $testroot/repo/beta
1449 git_commit $testroot/repo -m "modified beta"
1450 local commit_id2=`git_show_head $testroot/repo`
1452 got branch -r $testroot/repo -c $commit_id2 hoo
1453 (cd $testroot/repo && git checkout -q hoo)
1454 echo "modified delta on hoo" > $testroot/repo/gamma/delta
1455 git_commit $testroot/repo -m "modified delta"
1456 local commit_id3=`git_show_head $testroot/repo`
1458 (cd $testroot/repo && git checkout -q master)
1459 got clone -q $testurl/repo $testroot/repo-clone
1461 if [ $ret -ne 0 ]; then
1462 echo "got clone command failed unexpectedly" >&2
1463 test_done "$testroot" "$ret"
1467 # only clone will have foo and bar
1468 got branch -r $testroot/repo-clone -c $commit_id foo
1469 got branch -r $testroot/repo-clone -c $commit_id bar
1471 got fetch -q -r $testroot/repo-clone > $testroot/stdout
1473 if [ $ret -ne 0 ]; then
1474 echo "got fetch command failed unexpectedly" >&2
1475 test_done "$testroot" "$ret"
1479 echo -n > $testroot/stdout.expected
1481 cmp -s $testroot/stdout $testroot/stdout.expected
1483 if [ $ret -ne 0 ]; then
1484 diff -u $testroot/stdout.expected $testroot/stdout
1485 test_done "$testroot" "$ret"
1489 got ref -l -r $testroot/repo-clone > $testroot/stdout
1491 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1492 echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1493 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1494 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1495 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1496 >> $testroot/stdout.expected
1497 echo "refs/remotes/origin/master: $commit_id" \
1498 >> $testroot/stdout.expected
1500 cmp -s $testroot/stdout $testroot/stdout.expected
1502 if [ $ret -ne 0 ]; then
1503 diff -u $testroot/stdout.expected $testroot/stdout
1504 test_done "$testroot" "$ret"
1508 (cd $testroot/repo && git checkout -q boo)
1509 # clone has remote/origin/HEAD symref with "master" as its target
1510 # but the repo has changed HEAD to "boo", so we should fetch "boo"
1511 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1512 echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1513 echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1514 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1515 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1516 echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
1517 >> $testroot/stdout.expected
1518 echo "refs/remotes/origin/boo: $commit_id2" \
1519 >> $testroot/stdout.expected
1520 echo "refs/remotes/origin/master: $commit_id" \
1521 >> $testroot/stdout.expected
1523 got fetch -q -r $testroot/repo-clone > $testroot/stdout
1525 if [ $ret -ne 0 ]; then
1526 echo "got fetch command failed unexpectedly" >&2
1527 test_done "$testroot" "$ret"
1531 got ref -l -r $testroot/repo-clone > $testroot/stdout
1533 cmp -s $testroot/stdout $testroot/stdout.expected
1535 if [ $ret -ne 0 ]; then
1536 diff -u $testroot/stdout.expected $testroot/stdout
1537 test_done "$testroot" "$ret"
1541 # from repo: fetch -b hoo
1542 got fetch -q -r $testroot/repo-clone -b hoo > $testroot/stdout
1544 if [ $ret -ne 0 ]; then
1545 echo "got fetch command failed unexpectedly" >&2
1546 test_done "$testroot" "$ret"
1550 echo -n > $testroot/stdout.expected
1552 cmp -s $testroot/stdout $testroot/stdout.expected
1554 if [ $ret -ne 0 ]; then
1555 diff -u $testroot/stdout.expected $testroot/stdout
1556 test_done "$testroot" "$ret"
1560 got ref -l -r $testroot/repo-clone > $testroot/stdout
1562 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1563 echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1564 echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1565 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1566 echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1567 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1568 echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
1569 >> $testroot/stdout.expected
1570 echo "refs/remotes/origin/boo: $commit_id2" \
1571 >> $testroot/stdout.expected
1572 echo "refs/remotes/origin/hoo: $commit_id3" \
1573 >> $testroot/stdout.expected
1574 echo "refs/remotes/origin/master: $commit_id" \
1575 >> $testroot/stdout.expected
1577 cmp -s $testroot/stdout $testroot/stdout.expected
1579 if [ $ret -ne 0 ]; then
1580 diff -u $testroot/stdout.expected $testroot/stdout
1581 test_done "$testroot" "$ret"
1585 # from repo: fetch -b foo which doesn't exist on the server but
1586 # do not fallback to repo HEAD "boo" because we used the -b flag
1587 got fetch -r $testroot/repo-clone -b foo > $testroot/stdout \
1590 echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo" \
1591 > $testroot/stdout.expected
1592 echo "got-fetch-pack: branch \"foo\" not found on server" \
1593 > $testroot/stderr.expected
1594 echo "got: could not find any branches to fetch" \
1595 >> $testroot/stderr.expected
1597 cmp -s $testroot/stdout $testroot/stdout.expected
1599 if [ $ret -ne 0 ]; then
1600 diff -u $testroot/stdout.expected $testroot/stdout
1601 test_done "$testroot" "$ret"
1605 cmp -s $testroot/stderr $testroot/stderr.expected
1607 if [ $ret -ne 0 ]; then
1608 diff -u $testroot/stderr.expected $testroot/stderr
1609 test_done "$testroot" "$ret"
1613 # from repo: fetch got.conf branch which doesn't exist, so fallback
1614 # to repo HEAD "boo"
1615 # change default branch in got.conf from "master" to "foo"
1616 ed -s $testroot/repo-clone/got.conf <<-EOF
1621 got fetch -q -r $testroot/repo-clone > $testroot/stdout
1623 if [ $ret -ne 0 ]; then
1624 echo "got fetch command failed unexpectedly" >&2
1625 test_done "$testroot" "$ret"
1629 echo -n > $testroot/stdout.expected
1631 cmp -s $testroot/stdout $testroot/stdout.expected
1633 if [ $ret -ne 0 ]; then
1634 diff -u $testroot/stdout.expected $testroot/stdout
1635 test_done "$testroot" "$ret"
1639 got ref -l -r $testroot/repo-clone > $testroot/stdout
1641 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1642 echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1643 echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1644 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1645 echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1646 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1647 echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
1648 >> $testroot/stdout.expected
1649 echo "refs/remotes/origin/boo: $commit_id2" \
1650 >> $testroot/stdout.expected
1651 echo "refs/remotes/origin/hoo: $commit_id3" \
1652 >> $testroot/stdout.expected
1653 echo "refs/remotes/origin/master: $commit_id" \
1654 >> $testroot/stdout.expected
1656 cmp -s $testroot/stdout $testroot/stdout.expected
1658 if [ $ret -ne 0 ]; then
1659 diff -u $testroot/stdout.expected $testroot/stdout
1660 test_done "$testroot" "$ret"
1664 # from wt: fetch got.conf "foo", which doesn't exist on the server,
1665 # and implicit wt branch "boo", not repo HEAD "master"
1666 echo "modified delta on boo" > $testroot/repo/gamma/delta
1667 git_commit $testroot/repo -m "modified delta"
1668 local commit_id4=`git_show_head $testroot/repo`
1670 (cd $testroot/repo && git checkout -q master)
1672 got checkout -b boo $testroot/repo-clone $testroot/wt > /dev/null
1673 (cd $testroot/wt && got fetch -q > $testroot/stdout)
1675 echo -n > $testroot/stdout.expected
1677 cmp -s $testroot/stdout $testroot/stdout.expected
1679 if [ $ret -ne 0 ]; then
1680 diff -u $testroot/stdout.expected $testroot/stdout
1681 test_done "$testroot" "$ret"
1685 local wt_uuid=`(cd $testroot/wt && got info | grep 'UUID:' | \
1686 cut -d ':' -f 2 | tr -d ' ')`
1688 got ref -l -r $testroot/repo-clone > $testroot/stdout
1690 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1691 echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
1692 >> $testroot/stdout.expected
1693 echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1694 echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1695 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1696 echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1697 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1698 echo "refs/remotes/origin/HEAD: refs/remotes/origin/master" \
1699 >> $testroot/stdout.expected
1700 echo "refs/remotes/origin/boo: $commit_id4" \
1701 >> $testroot/stdout.expected
1702 echo "refs/remotes/origin/hoo: $commit_id3" \
1703 >> $testroot/stdout.expected
1704 echo "refs/remotes/origin/master: $commit_id" \
1705 >> $testroot/stdout.expected
1707 cmp -s $testroot/stdout $testroot/stdout.expected
1709 if [ $ret -ne 0 ]; then
1710 diff -u $testroot/stdout.expected $testroot/stdout
1711 test_done "$testroot" "$ret"
1715 # from wt: fetch got.conf "master", wt "boo", and the repo's new HEAD
1716 # "hoo" as it no longer matches our remote HEAD symref target "master"
1717 ed -s $testroot/repo-clone/got.conf <<-EOF
1721 echo "modified delta on master" > $testroot/repo/gamma/delta
1722 git_commit $testroot/repo -m "modified delta on master"
1723 local commit_id5=`git_show_head $testroot/repo`
1725 (cd $testroot/repo && git checkout -q boo)
1726 echo "modified alpha on boo" > $testroot/repo/alpha
1727 git_commit $testroot/repo -m "modified alpha on boo"
1728 local commit_id6=`git_show_head $testroot/repo`
1730 (cd $testroot/repo && git checkout -q hoo)
1731 echo "modified beta on hoo" > $testroot/repo/beta
1732 git_commit $testroot/repo -m "modified beta on hoo"
1733 local commit_id7=`git_show_head $testroot/repo`
1735 (cd $testroot/wt && got fetch -q > $testroot/stdout)
1737 echo -n > $testroot/stdout.expected
1739 cmp -s $testroot/stdout $testroot/stdout.expected
1741 if [ $ret -ne 0 ]; then
1742 diff -u $testroot/stdout.expected $testroot/stdout
1743 test_done "$testroot" "$ret"
1747 got ref -l -r $testroot/repo-clone > $testroot/stdout
1749 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1750 echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
1751 >> $testroot/stdout.expected
1752 echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1753 echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1754 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1755 echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1756 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1757 echo "refs/remotes/origin/HEAD: refs/remotes/origin/hoo" \
1758 >> $testroot/stdout.expected
1759 echo "refs/remotes/origin/boo: $commit_id6" \
1760 >> $testroot/stdout.expected
1761 echo "refs/remotes/origin/hoo: $commit_id7" \
1762 >> $testroot/stdout.expected
1763 echo "refs/remotes/origin/master: $commit_id5" \
1764 >> $testroot/stdout.expected
1766 cmp -s $testroot/stdout $testroot/stdout.expected
1768 if [ $ret -ne 0 ]; then
1769 diff -u $testroot/stdout.expected $testroot/stdout
1770 test_done "$testroot" "$ret"
1774 # from wt: fetch -b hoo not got.conf "master" or wt "boo" or
1776 (cd $testroot/repo && git checkout -q boo)
1777 echo "modified alpha again on boo" > $testroot/repo/alpha
1778 git_commit $testroot/repo -m "modified alpha again on boo"
1779 local commit_id8=`git_show_head $testroot/repo`
1781 (cd $testroot/wt && got fetch -q -b hoo > $testroot/stdout)
1783 echo -n > $testroot/stdout.expected
1785 cmp -s $testroot/stdout $testroot/stdout.expected
1787 if [ $ret -ne 0 ]; then
1788 diff -u $testroot/stdout.expected $testroot/stdout
1789 test_done "$testroot" "$ret"
1793 got ref -l -r $testroot/repo-clone > $testroot/stdout
1795 echo "HEAD: refs/heads/master" > $testroot/stdout.expected
1796 echo "refs/got/worktree/base-$wt_uuid: $commit_id2" \
1797 >> $testroot/stdout.expected
1798 echo "refs/heads/bar: $commit_id" >> $testroot/stdout.expected
1799 echo "refs/heads/boo: $commit_id2" >> $testroot/stdout.expected
1800 echo "refs/heads/foo: $commit_id" >> $testroot/stdout.expected
1801 echo "refs/heads/hoo: $commit_id3" >> $testroot/stdout.expected
1802 echo "refs/heads/master: $commit_id" >> $testroot/stdout.expected
1803 echo "refs/remotes/origin/HEAD: refs/remotes/origin/boo" \
1804 >> $testroot/stdout.expected
1805 echo "refs/remotes/origin/boo: $commit_id6" \
1806 >> $testroot/stdout.expected
1807 echo "refs/remotes/origin/hoo: $commit_id7" \
1808 >> $testroot/stdout.expected
1809 echo "refs/remotes/origin/master: $commit_id5" \
1810 >> $testroot/stdout.expected
1812 cmp -s $testroot/stdout $testroot/stdout.expected
1814 if [ $ret -ne 0 ]; then
1815 diff -u $testroot/stdout.expected $testroot/stdout
1816 test_done "$testroot" "$ret"
1820 # from wt: fetch -b bar that doesn't exist on the server but
1821 # do not fetch got.conf "master" or wt "boo" or repo HEAD "boo"
1822 (cd $testroot/wt && got fetch -b bar > $testroot/stdout \
1823 2> $testroot/stderr)
1825 echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo" \
1826 > $testroot/stdout.expected
1827 echo "got-fetch-pack: branch \"bar\" not found on server" \
1828 > $testroot/stderr.expected
1829 echo "got: could not find any branches to fetch" \
1830 >> $testroot/stderr.expected
1832 cmp -s $testroot/stderr $testroot/stderr.expected
1834 if [ $ret -ne 0 ]; then
1835 diff -u $testroot/stderr.expected $testroot/stderr
1836 test_done "$testroot" "$ret"
1840 cmp -s $testroot/stdout $testroot/stdout.expected
1842 if [ $ret -ne 0 ]; then
1843 diff -u $testroot/stdout.expected $testroot/stdout
1845 test_done "$testroot" "$ret"
1848 test_fetch_from_out_of_date_remote() {
1849 local testroot=`test_init fetch_from_out_of_date_remote`
1850 local testurl=ssh://127.0.0.1/$testroot
1851 local commit_id=`git_show_head $testroot/repo`
1853 got clone -q $testurl/repo $testroot/repo-clone
1855 if [ $ret -ne 0 ]; then
1856 echo "got clone command failed unexpectedly" >&2
1857 test_done "$testroot" "$ret"
1861 echo "modified alpha" > $testroot/repo/alpha
1862 git_commit $testroot/repo -m "modified alpha"
1863 local commit_id2=`git_show_head $testroot/repo`
1865 got clone -q $testurl/repo $testroot/repo-clone2 \
1866 > $testroot/stdout 2> $testroot/stderr
1868 if [ $ret -ne 0 ]; then
1869 echo "got clone command failed unexpectedly" >&2
1870 test_done "$testroot" "$ret"
1874 got ref -l -r $testroot/repo-clone2 > $testroot/stdout
1876 if [ $ret -ne 0 ]; then
1877 echo "got ref command failed unexpectedly" >&2
1878 test_done "$testroot" "$ret"
1882 cat > $testroot/stdout.expected <<EOF
1883 HEAD: refs/heads/master
1884 refs/heads/master: $commit_id2
1885 refs/remotes/origin/HEAD: refs/remotes/origin/master
1886 refs/remotes/origin/master: $commit_id2
1888 cmp -s $testroot/stdout $testroot/stdout.expected
1890 if [ $ret -ne 0 ]; then
1891 diff -u $testroot/stdout.expected $testroot/stdout
1892 test_done "$testroot" "$ret"
1896 cat >> $testroot/repo-clone2/got.conf <<EOF
1900 repository "$testroot/repo-clone"
1904 got fetch -q -r $testroot/repo-clone2 other \
1905 > $testroot/stdout 2> $testroot/stderr
1907 if [ $ret -ne 0 ]; then
1908 echo "got fetch command failed unexpectedly" >&2
1909 test_done "$testroot" "$ret"
1913 got ref -l -r $testroot/repo-clone2 > $testroot/stdout
1915 if [ $ret -ne 0 ]; then
1916 echo "got ref command failed unexpectedly" >&2
1917 test_done "$testroot" "$ret"
1921 cat > $testroot/stdout.expected <<EOF
1922 HEAD: refs/heads/master
1923 refs/heads/master: $commit_id2
1924 refs/remotes/origin/HEAD: refs/remotes/origin/master
1925 refs/remotes/origin/master: $commit_id2
1926 refs/remotes/other/HEAD: refs/remotes/other/master
1927 refs/remotes/other/master: $commit_id
1929 cmp -s $testroot/stdout $testroot/stdout.expected
1931 if [ $ret -ne 0 ]; then
1932 diff -u $testroot/stdout.expected $testroot/stdout
1934 test_done "$testroot" "$ret"
1939 run_test test_fetch_basic
1940 run_test test_fetch_list
1941 run_test test_fetch_branch
1942 run_test test_fetch_all
1943 run_test test_fetch_empty_packfile
1944 run_test test_fetch_delete_branch
1945 run_test test_fetch_delete_branch_mirror
1946 run_test test_fetch_update_tag
1947 run_test test_fetch_reference
1948 run_test test_fetch_replace_symref
1949 run_test test_fetch_update_headref
1950 run_test test_fetch_headref_deleted_locally
1951 run_test test_fetch_gotconfig_remote_repo
1952 run_test test_fetch_delete_remote_refs
1953 run_test test_fetch_honor_wt_conf_bflag
1954 run_test test_fetch_from_out_of_date_remote