]> git.ipfire.org Git - thirdparty/git.git/blob - t/t5505-remote.sh
Merge branch 'jk/clone-allow-bare-and-o-together'
[thirdparty/git.git] / t / t5505-remote.sh
1 #!/bin/sh
2
3 test_description='git remote porcelain-ish'
4
5 . ./test-lib.sh
6
7 setup_repository () {
8 mkdir "$1" && (
9 cd "$1" &&
10 git init -b main &&
11 >file &&
12 git add file &&
13 test_tick &&
14 git commit -m "Initial" &&
15 git checkout -b side &&
16 >elif &&
17 git add elif &&
18 test_tick &&
19 git commit -m "Second" &&
20 git checkout main
21 )
22 }
23
24 tokens_match () {
25 echo "$1" | tr ' ' '\012' | sort | sed -e '/^$/d' >expect &&
26 echo "$2" | tr ' ' '\012' | sort | sed -e '/^$/d' >actual &&
27 test_cmp expect actual
28 }
29
30 check_remote_track () {
31 actual=$(git remote show "$1" | sed -ne 's|^ \(.*\) tracked$|\1|p')
32 shift &&
33 tokens_match "$*" "$actual"
34 }
35
36 check_tracking_branch () {
37 f="" &&
38 r=$(git for-each-ref "--format=%(refname)" |
39 sed -ne "s|^refs/remotes/$1/||p") &&
40 shift &&
41 tokens_match "$*" "$r"
42 }
43
44 test_expect_success setup '
45 setup_repository one &&
46 setup_repository two &&
47 (
48 cd two &&
49 git branch another
50 ) &&
51 git clone one test
52 '
53
54 test_expect_success 'add remote whose URL agrees with url.<...>.insteadOf' '
55 test_config url.git@host.com:team/repo.git.insteadOf myremote &&
56 git remote add myremote git@host.com:team/repo.git
57 '
58
59 test_expect_success 'remote information for the origin' '
60 (
61 cd test &&
62 tokens_match origin "$(git remote)" &&
63 check_remote_track origin main side &&
64 check_tracking_branch origin HEAD main side
65 )
66 '
67
68 test_expect_success 'add another remote' '
69 (
70 cd test &&
71 git remote add -f second ../two &&
72 tokens_match "origin second" "$(git remote)" &&
73 check_tracking_branch second main side another &&
74 git for-each-ref "--format=%(refname)" refs/remotes |
75 sed -e "/^refs\/remotes\/origin\//d" \
76 -e "/^refs\/remotes\/second\//d" >actual &&
77 test_must_be_empty actual
78 )
79 '
80
81 test_expect_success 'setup bare clone for server' '
82 git clone --bare "file://$(pwd)/one" srv.bare &&
83 git -C srv.bare config --local uploadpack.allowfilter 1 &&
84 git -C srv.bare config --local uploadpack.allowanysha1inwant 1
85 '
86
87 test_expect_success 'filters for promisor remotes are listed by git remote -v' '
88 test_when_finished "rm -rf pc" &&
89 git clone --filter=blob:none "file://$(pwd)/srv.bare" pc &&
90 git -C pc remote -v >out &&
91 grep "srv.bare (fetch) \[blob:none\]" out &&
92
93 git -C pc config remote.origin.partialCloneFilter object:type=commit &&
94 git -C pc remote -v >out &&
95 grep "srv.bare (fetch) \[object:type=commit\]" out
96 '
97
98 test_expect_success 'filters should not be listed for non promisor remotes (remote -v)' '
99 test_when_finished "rm -rf pc" &&
100 git clone one pc &&
101 git -C pc remote -v >out &&
102 ! grep "(fetch) \[.*\]" out
103 '
104
105 test_expect_success 'filters are listed by git remote -v only' '
106 test_when_finished "rm -rf pc" &&
107 git clone --filter=blob:none "file://$(pwd)/srv.bare" pc &&
108 git -C pc remote >out &&
109 ! grep "\[blob:none\]" out &&
110
111 git -C pc remote show >out &&
112 ! grep "\[blob:none\]" out
113 '
114
115 test_expect_success 'check remote-tracking' '
116 (
117 cd test &&
118 check_remote_track origin main side &&
119 check_remote_track second main side another
120 )
121 '
122
123 test_expect_success 'remote forces tracking branches' '
124 (
125 cd test &&
126 case $(git config remote.second.fetch) in
127 +*) true ;;
128 *) false ;;
129 esac
130 )
131 '
132
133 test_expect_success 'remove remote' '
134 (
135 cd test &&
136 git symbolic-ref refs/remotes/second/HEAD refs/remotes/second/main &&
137 git remote rm second
138 )
139 '
140
141 test_expect_success 'remove remote' '
142 (
143 cd test &&
144 tokens_match origin "$(git remote)" &&
145 check_remote_track origin main side &&
146 git for-each-ref "--format=%(refname)" refs/remotes |
147 sed -e "/^refs\/remotes\/origin\//d" >actual &&
148 test_must_be_empty actual
149 )
150 '
151
152 test_expect_success 'remove remote protects local branches' '
153 (
154 cd test &&
155 cat >expect1 <<-\EOF &&
156 Note: A branch outside the refs/remotes/ hierarchy was not removed;
157 to delete it, use:
158 git branch -d main
159 EOF
160 cat >expect2 <<-\EOF &&
161 Note: Some branches outside the refs/remotes/ hierarchy were not removed;
162 to delete them, use:
163 git branch -d foobranch
164 git branch -d main
165 EOF
166 git tag footag &&
167 git config --add remote.oops.fetch "+refs/*:refs/*" &&
168 git remote remove oops 2>actual1 &&
169 git branch foobranch &&
170 git config --add remote.oops.fetch "+refs/*:refs/*" &&
171 git remote rm oops 2>actual2 &&
172 git branch -d foobranch &&
173 git tag -d footag &&
174 test_cmp expect1 actual1 &&
175 test_cmp expect2 actual2
176 )
177 '
178
179 test_expect_success 'remove errors out early when deleting non-existent branch' '
180 (
181 cd test &&
182 echo "error: No such remote: '\''foo'\''" >expect &&
183 test_expect_code 2 git remote rm foo 2>actual &&
184 test_cmp expect actual
185 )
186 '
187
188 test_expect_success 'remove remote with a branch without configured merge' '
189 test_when_finished "(
190 git -C test checkout main;
191 git -C test branch -D two;
192 git -C test config --remove-section remote.two;
193 git -C test config --remove-section branch.second;
194 true
195 )" &&
196 (
197 cd test &&
198 git remote add two ../two &&
199 git fetch two &&
200 git checkout -b second two/main^0 &&
201 git config branch.second.remote two &&
202 git checkout main &&
203 git remote rm two
204 )
205 '
206
207 test_expect_success 'rename errors out early when deleting non-existent branch' '
208 (
209 cd test &&
210 echo "error: No such remote: '\''foo'\''" >expect &&
211 test_expect_code 2 git remote rename foo bar 2>actual &&
212 test_cmp expect actual
213 )
214 '
215
216 test_expect_success 'rename errors out early when new name is invalid' '
217 test_config remote.foo.vcs bar &&
218 echo "fatal: '\''invalid...name'\'' is not a valid remote name" >expect &&
219 test_must_fail git remote rename foo invalid...name 2>actual &&
220 test_cmp expect actual
221 '
222
223 test_expect_success 'add existing foreign_vcs remote' '
224 test_config remote.foo.vcs bar &&
225 echo "error: remote foo already exists." >expect &&
226 test_expect_code 3 git remote add foo bar 2>actual &&
227 test_cmp expect actual
228 '
229
230 test_expect_success 'add existing foreign_vcs remote' '
231 test_config remote.foo.vcs bar &&
232 test_config remote.bar.vcs bar &&
233 echo "error: remote bar already exists." >expect &&
234 test_expect_code 3 git remote rename foo bar 2>actual &&
235 test_cmp expect actual
236 '
237
238 test_expect_success 'add invalid foreign_vcs remote' '
239 echo "fatal: '\''invalid...name'\'' is not a valid remote name" >expect &&
240 test_must_fail git remote add invalid...name bar 2>actual &&
241 test_cmp expect actual
242 '
243
244 test_expect_success 'without subcommand' '
245 echo origin >expect &&
246 git -C test remote >actual &&
247 test_cmp expect actual
248 '
249
250 test_expect_success 'without subcommand accepts -v' '
251 cat >expect <<-EOF &&
252 origin $(pwd)/one (fetch)
253 origin $(pwd)/one (push)
254 EOF
255 git -C test remote -v >actual &&
256 test_cmp expect actual
257 '
258
259 test_expect_success 'without subcommand does not take arguments' '
260 test_expect_code 129 git -C test remote origin 2>err &&
261 grep "^error: unknown subcommand:" err
262 '
263
264 cat >test/expect <<EOF
265 * remote origin
266 Fetch URL: $(pwd)/one
267 Push URL: $(pwd)/one
268 HEAD branch: main
269 Remote branches:
270 main new (next fetch will store in remotes/origin)
271 side tracked
272 Local branches configured for 'git pull':
273 ahead merges with remote main
274 main merges with remote main
275 octopus merges with remote topic-a
276 and with remote topic-b
277 and with remote topic-c
278 rebase rebases onto remote main
279 Local refs configured for 'git push':
280 main pushes to main (local out of date)
281 main pushes to upstream (create)
282 * remote two
283 Fetch URL: ../two
284 Push URL: ../three
285 HEAD branch: main
286 Local refs configured for 'git push':
287 ahead forces to main (fast-forwardable)
288 main pushes to another (up to date)
289 EOF
290
291 test_expect_success 'show' '
292 (
293 cd test &&
294 git config --add remote.origin.fetch refs/heads/main:refs/heads/upstream &&
295 git fetch &&
296 git checkout -b ahead origin/main &&
297 echo 1 >>file &&
298 test_tick &&
299 git commit -m update file &&
300 git checkout main &&
301 git branch --track octopus origin/main &&
302 git branch --track rebase origin/main &&
303 git branch -d -r origin/main &&
304 git config --add remote.two.url ../two &&
305 git config --add remote.two.pushurl ../three &&
306 git config branch.rebase.rebase true &&
307 git config branch.octopus.merge "topic-a topic-b topic-c" &&
308 (
309 cd ../one &&
310 echo 1 >file &&
311 test_tick &&
312 git commit -m update file
313 ) &&
314 git config --add remote.origin.push : &&
315 git config --add remote.origin.push refs/heads/main:refs/heads/upstream &&
316 git config --add remote.origin.push +refs/tags/lastbackup &&
317 git config --add remote.two.push +refs/heads/ahead:refs/heads/main &&
318 git config --add remote.two.push refs/heads/main:refs/heads/another &&
319 git remote show origin two >output &&
320 git branch -d rebase octopus &&
321 test_cmp expect output
322 )
323 '
324
325 cat >expect <<EOF
326 * remote origin
327 Fetch URL: $(pwd)/one
328 Push URL: $(pwd)/one
329 HEAD branch: main
330 Remote branches:
331 main skipped
332 side tracked
333 Local branches configured for 'git pull':
334 ahead merges with remote main
335 main merges with remote main
336 Local refs configured for 'git push':
337 main pushes to main (local out of date)
338 main pushes to upstream (create)
339 EOF
340
341 test_expect_success 'show with negative refspecs' '
342 test_when_finished "git -C test config --unset-all --fixed-value remote.origin.fetch ^refs/heads/main" &&
343 git -C test config --add remote.origin.fetch ^refs/heads/main &&
344 git -C test remote show origin >output &&
345 test_cmp expect output
346 '
347
348 cat >expect <<EOF
349 * remote origin
350 Fetch URL: $(pwd)/one
351 Push URL: $(pwd)/one
352 HEAD branch: main
353 Remote branches:
354 main new (next fetch will store in remotes/origin)
355 side stale (use 'git remote prune' to remove)
356 Local branches configured for 'git pull':
357 ahead merges with remote main
358 main merges with remote main
359 Local refs configured for 'git push':
360 main pushes to main (local out of date)
361 main pushes to upstream (create)
362 EOF
363
364 test_expect_failure 'show stale with negative refspecs' '
365 test_when_finished "git -C test config --unset-all --fixed-value remote.origin.fetch ^refs/heads/side" &&
366 git -C test config --add remote.origin.fetch ^refs/heads/side &&
367 git -C test remote show origin >output &&
368 test_cmp expect output
369 '
370
371 cat >test/expect <<EOF
372 * remote origin
373 Fetch URL: $(pwd)/one
374 Push URL: $(pwd)/one
375 HEAD branch: (not queried)
376 Remote branches: (status not queried)
377 main
378 side
379 Local branches configured for 'git pull':
380 ahead merges with remote main
381 main merges with remote main
382 Local refs configured for 'git push' (status not queried):
383 (matching) pushes to (matching)
384 refs/heads/main pushes to refs/heads/upstream
385 refs/tags/lastbackup forces to refs/tags/lastbackup
386 EOF
387
388 test_expect_success 'show -n' '
389 mv one one.unreachable &&
390 (
391 cd test &&
392 git remote show -n origin >output &&
393 mv ../one.unreachable ../one &&
394 test_cmp expect output
395 )
396 '
397
398 test_expect_success 'prune' '
399 (
400 cd one &&
401 git branch -m side side2
402 ) &&
403 (
404 cd test &&
405 git fetch origin &&
406 git remote prune origin &&
407 git rev-parse refs/remotes/origin/side2 &&
408 test_must_fail git rev-parse refs/remotes/origin/side
409 )
410 '
411
412 test_expect_success 'set-head --delete' '
413 (
414 cd test &&
415 git symbolic-ref refs/remotes/origin/HEAD &&
416 git remote set-head --delete origin &&
417 test_must_fail git symbolic-ref refs/remotes/origin/HEAD
418 )
419 '
420
421 test_expect_success 'set-head --auto' '
422 (
423 cd test &&
424 git remote set-head --auto origin &&
425 echo refs/remotes/origin/main >expect &&
426 git symbolic-ref refs/remotes/origin/HEAD >output &&
427 test_cmp expect output
428 )
429 '
430
431 test_expect_success 'set-head --auto has no problem w/multiple HEADs' '
432 (
433 cd test &&
434 git fetch two "refs/heads/*:refs/remotes/two/*" &&
435 git remote set-head --auto two >output 2>&1 &&
436 echo "two/HEAD set to main" >expect &&
437 test_cmp expect output
438 )
439 '
440
441 cat >test/expect <<\EOF
442 refs/remotes/origin/side2
443 EOF
444
445 test_expect_success 'set-head explicit' '
446 (
447 cd test &&
448 git remote set-head origin side2 &&
449 git symbolic-ref refs/remotes/origin/HEAD >output &&
450 git remote set-head origin main &&
451 test_cmp expect output
452 )
453 '
454
455 cat >test/expect <<EOF
456 Pruning origin
457 URL: $(pwd)/one
458 * [would prune] origin/side2
459 EOF
460
461 test_expect_success 'prune --dry-run' '
462 git -C one branch -m side2 side &&
463 test_when_finished "git -C one branch -m side side2" &&
464 (
465 cd test &&
466 git remote prune --dry-run origin >output &&
467 git rev-parse refs/remotes/origin/side2 &&
468 test_must_fail git rev-parse refs/remotes/origin/side &&
469 test_cmp expect output
470 )
471 '
472
473 test_expect_success 'add --mirror && prune' '
474 mkdir mirror &&
475 (
476 cd mirror &&
477 git init --bare &&
478 git remote add --mirror -f origin ../one
479 ) &&
480 (
481 cd one &&
482 git branch -m side2 side
483 ) &&
484 (
485 cd mirror &&
486 git rev-parse --verify refs/heads/side2 &&
487 test_must_fail git rev-parse --verify refs/heads/side &&
488 git fetch origin &&
489 git remote prune origin &&
490 test_must_fail git rev-parse --verify refs/heads/side2 &&
491 git rev-parse --verify refs/heads/side
492 )
493 '
494
495 test_expect_success 'add --mirror=fetch' '
496 mkdir mirror-fetch &&
497 git init -b main mirror-fetch/parent &&
498 (
499 cd mirror-fetch/parent &&
500 test_commit one
501 ) &&
502 git init --bare mirror-fetch/child &&
503 (
504 cd mirror-fetch/child &&
505 git remote add --mirror=fetch -f parent ../parent
506 )
507 '
508
509 test_expect_success 'fetch mirrors act as mirrors during fetch' '
510 (
511 cd mirror-fetch/parent &&
512 git branch new &&
513 git branch -m main renamed
514 ) &&
515 (
516 cd mirror-fetch/child &&
517 git fetch parent &&
518 git rev-parse --verify refs/heads/new &&
519 git rev-parse --verify refs/heads/renamed
520 )
521 '
522
523 test_expect_success 'fetch mirrors can prune' '
524 (
525 cd mirror-fetch/child &&
526 git remote prune parent &&
527 test_must_fail git rev-parse --verify refs/heads/main
528 )
529 '
530
531 test_expect_success 'fetch mirrors do not act as mirrors during push' '
532 (
533 cd mirror-fetch/parent &&
534 git checkout HEAD^0
535 ) &&
536 (
537 cd mirror-fetch/child &&
538 git branch -m renamed renamed2 &&
539 git push parent :
540 ) &&
541 (
542 cd mirror-fetch/parent &&
543 git rev-parse --verify renamed &&
544 test_must_fail git rev-parse --verify refs/heads/renamed2
545 )
546 '
547
548 test_expect_success 'add fetch mirror with specific branches' '
549 git init --bare mirror-fetch/track &&
550 (
551 cd mirror-fetch/track &&
552 git remote add --mirror=fetch -t heads/new parent ../parent
553 )
554 '
555
556 test_expect_success 'fetch mirror respects specific branches' '
557 (
558 cd mirror-fetch/track &&
559 git fetch parent &&
560 git rev-parse --verify refs/heads/new &&
561 test_must_fail git rev-parse --verify refs/heads/renamed
562 )
563 '
564
565 test_expect_success 'add --mirror=push' '
566 mkdir mirror-push &&
567 git init --bare mirror-push/public &&
568 git init -b main mirror-push/private &&
569 (
570 cd mirror-push/private &&
571 test_commit one &&
572 git remote add --mirror=push public ../public
573 )
574 '
575
576 test_expect_success 'push mirrors act as mirrors during push' '
577 (
578 cd mirror-push/private &&
579 git branch new &&
580 git branch -m main renamed &&
581 git push public
582 ) &&
583 (
584 cd mirror-push/private &&
585 git rev-parse --verify refs/heads/new &&
586 git rev-parse --verify refs/heads/renamed &&
587 test_must_fail git rev-parse --verify refs/heads/main
588 )
589 '
590
591 test_expect_success 'push mirrors do not act as mirrors during fetch' '
592 (
593 cd mirror-push/public &&
594 git branch -m renamed renamed2 &&
595 git symbolic-ref HEAD refs/heads/renamed2
596 ) &&
597 (
598 cd mirror-push/private &&
599 git fetch public &&
600 git rev-parse --verify refs/heads/renamed &&
601 test_must_fail git rev-parse --verify refs/heads/renamed2
602 )
603 '
604
605 test_expect_success 'push mirrors do not allow you to specify refs' '
606 git init mirror-push/track &&
607 (
608 cd mirror-push/track &&
609 test_must_fail git remote add --mirror=push -t new public ../public
610 )
611 '
612
613 test_expect_success 'add alt && prune' '
614 mkdir alttst &&
615 (
616 cd alttst &&
617 git init &&
618 git remote add -f origin ../one &&
619 git config remote.alt.url ../one &&
620 git config remote.alt.fetch "+refs/heads/*:refs/remotes/origin/*"
621 ) &&
622 (
623 cd one &&
624 git branch -m side side2
625 ) &&
626 (
627 cd alttst &&
628 git rev-parse --verify refs/remotes/origin/side &&
629 test_must_fail git rev-parse --verify refs/remotes/origin/side2 &&
630 git fetch alt &&
631 git remote prune alt &&
632 test_must_fail git rev-parse --verify refs/remotes/origin/side &&
633 git rev-parse --verify refs/remotes/origin/side2
634 )
635 '
636
637 cat >test/expect <<\EOF
638 some-tag
639 EOF
640
641 test_expect_success 'add with reachable tags (default)' '
642 (
643 cd one &&
644 >foobar &&
645 git add foobar &&
646 git commit -m "Foobar" &&
647 git tag -a -m "Foobar tag" foobar-tag &&
648 git reset --hard HEAD~1 &&
649 git tag -a -m "Some tag" some-tag
650 ) &&
651 mkdir add-tags &&
652 (
653 cd add-tags &&
654 git init &&
655 git remote add -f origin ../one &&
656 git tag -l some-tag >../test/output &&
657 git tag -l foobar-tag >>../test/output &&
658 test_must_fail git config remote.origin.tagopt
659 ) &&
660 test_cmp test/expect test/output
661 '
662
663 cat >test/expect <<\EOF
664 some-tag
665 foobar-tag
666 --tags
667 EOF
668
669 test_expect_success 'add --tags' '
670 rm -rf add-tags &&
671 (
672 mkdir add-tags &&
673 cd add-tags &&
674 git init &&
675 git remote add -f --tags origin ../one &&
676 git tag -l some-tag >../test/output &&
677 git tag -l foobar-tag >>../test/output &&
678 git config remote.origin.tagopt >>../test/output
679 ) &&
680 test_cmp test/expect test/output
681 '
682
683 cat >test/expect <<\EOF
684 --no-tags
685 EOF
686
687 test_expect_success 'add --no-tags' '
688 rm -rf add-tags &&
689 (
690 mkdir add-no-tags &&
691 cd add-no-tags &&
692 git init &&
693 git remote add -f --no-tags origin ../one &&
694 grep tagOpt .git/config &&
695 git tag -l some-tag >../test/output &&
696 git tag -l foobar-tag >../test/output &&
697 git config remote.origin.tagopt >>../test/output
698 ) &&
699 (
700 cd one &&
701 git tag -d some-tag foobar-tag
702 ) &&
703 test_cmp test/expect test/output
704 '
705
706 test_expect_success 'reject --no-no-tags' '
707 (
708 cd add-no-tags &&
709 test_must_fail git remote add -f --no-no-tags neworigin ../one
710 )
711 '
712
713 cat >one/expect <<\EOF
714 apis/main
715 apis/side
716 drosophila/another
717 drosophila/main
718 drosophila/side
719 EOF
720
721 test_expect_success 'update' '
722 (
723 cd one &&
724 git remote add drosophila ../two &&
725 git remote add apis ../mirror &&
726 git remote update &&
727 git branch -r >output &&
728 test_cmp expect output
729 )
730 '
731
732 cat >one/expect <<\EOF
733 drosophila/another
734 drosophila/main
735 drosophila/side
736 manduca/main
737 manduca/side
738 megaloprepus/main
739 megaloprepus/side
740 EOF
741
742 test_expect_success 'update with arguments' '
743 (
744 cd one &&
745 for b in $(git branch -r)
746 do
747 git branch -r -d $b || exit 1
748 done &&
749 git remote add manduca ../mirror &&
750 git remote add megaloprepus ../mirror &&
751 git config remotes.phobaeticus "drosophila megaloprepus" &&
752 git config remotes.titanus manduca &&
753 git remote update phobaeticus titanus &&
754 git branch -r >output &&
755 test_cmp expect output
756 )
757 '
758
759 test_expect_success 'update --prune' '
760 (
761 cd one &&
762 git branch -m side2 side3
763 ) &&
764 (
765 cd test &&
766 git remote update --prune &&
767 (
768 cd ../one &&
769 git branch -m side3 side2
770 ) &&
771 git rev-parse refs/remotes/origin/side3 &&
772 test_must_fail git rev-parse refs/remotes/origin/side2
773 )
774 '
775
776 cat >one/expect <<-\EOF
777 apis/main
778 apis/side
779 manduca/main
780 manduca/side
781 megaloprepus/main
782 megaloprepus/side
783 EOF
784
785 test_expect_success 'update default' '
786 (
787 cd one &&
788 for b in $(git branch -r)
789 do
790 git branch -r -d $b || exit 1
791 done &&
792 git config remote.drosophila.skipDefaultUpdate true &&
793 git remote update default &&
794 git branch -r >output &&
795 test_cmp expect output
796 )
797 '
798
799 cat >one/expect <<\EOF
800 drosophila/another
801 drosophila/main
802 drosophila/side
803 EOF
804
805 test_expect_success 'update default (overridden, with funny whitespace)' '
806 (
807 cd one &&
808 for b in $(git branch -r)
809 do
810 git branch -r -d $b || exit 1
811 done &&
812 git config remotes.default "$(printf "\t drosophila \n")" &&
813 git remote update default &&
814 git branch -r >output &&
815 test_cmp expect output
816 )
817 '
818
819 test_expect_success 'update (with remotes.default defined)' '
820 (
821 cd one &&
822 for b in $(git branch -r)
823 do
824 git branch -r -d $b || exit 1
825 done &&
826 git config remotes.default "drosophila" &&
827 git remote update &&
828 git branch -r >output &&
829 test_cmp expect output
830 )
831 '
832
833 test_expect_success '"remote show" does not show symbolic refs' '
834 git clone one three &&
835 (
836 cd three &&
837 git remote show origin >output &&
838 ! grep "^ *HEAD$" < output &&
839 ! grep -i stale < output
840 )
841 '
842
843 test_expect_success 'reject adding remote with an invalid name' '
844 test_must_fail git remote add some:url desired-name
845 '
846
847 # The first three test if the tracking branches are properly renamed,
848 # the last two ones check if the config is updated.
849
850 test_expect_success 'rename a remote' '
851 test_config_global remote.pushDefault origin &&
852 git clone one four &&
853 (
854 cd four &&
855 git config branch.main.pushRemote origin &&
856 GIT_TRACE2_EVENT=$(pwd)/trace \
857 git remote rename --progress origin upstream &&
858 test_region progress "Renaming remote references" trace &&
859 grep "pushRemote" .git/config &&
860 test -z "$(git for-each-ref refs/remotes/origin)" &&
861 test "$(git symbolic-ref refs/remotes/upstream/HEAD)" = "refs/remotes/upstream/main" &&
862 test "$(git rev-parse upstream/main)" = "$(git rev-parse main)" &&
863 test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/remotes/upstream/*" &&
864 test "$(git config branch.main.remote)" = "upstream" &&
865 test "$(git config branch.main.pushRemote)" = "upstream" &&
866 test "$(git config --global remote.pushDefault)" = "origin"
867 )
868 '
869
870 test_expect_success 'rename a remote renames repo remote.pushDefault' '
871 git clone one four.1 &&
872 (
873 cd four.1 &&
874 git config remote.pushDefault origin &&
875 git remote rename origin upstream &&
876 grep pushDefault .git/config &&
877 test "$(git config --local remote.pushDefault)" = "upstream"
878 )
879 '
880
881 test_expect_success 'rename a remote renames repo remote.pushDefault but ignores global' '
882 test_config_global remote.pushDefault other &&
883 git clone one four.2 &&
884 (
885 cd four.2 &&
886 git config remote.pushDefault origin &&
887 git remote rename origin upstream &&
888 test "$(git config --global remote.pushDefault)" = "other" &&
889 test "$(git config --local remote.pushDefault)" = "upstream"
890 )
891 '
892
893 test_expect_success 'rename a remote renames repo remote.pushDefault but keeps global' '
894 test_config_global remote.pushDefault origin &&
895 git clone one four.3 &&
896 (
897 cd four.3 &&
898 git config remote.pushDefault origin &&
899 git remote rename origin upstream &&
900 test "$(git config --global remote.pushDefault)" = "origin" &&
901 test "$(git config --local remote.pushDefault)" = "upstream"
902 )
903 '
904
905 test_expect_success 'rename does not update a non-default fetch refspec' '
906 git clone one four.one &&
907 (
908 cd four.one &&
909 git config remote.origin.fetch +refs/heads/*:refs/heads/origin/* &&
910 git remote rename origin upstream &&
911 test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/heads/origin/*" &&
912 git rev-parse -q origin/main
913 )
914 '
915
916 test_expect_success 'rename a remote with name part of fetch spec' '
917 git clone one four.two &&
918 (
919 cd four.two &&
920 git remote rename origin remote &&
921 git remote rename remote upstream &&
922 test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/remotes/upstream/*"
923 )
924 '
925
926 test_expect_success 'rename a remote with name prefix of other remote' '
927 git clone one four.three &&
928 (
929 cd four.three &&
930 git remote add o git://example.com/repo.git &&
931 git remote rename o upstream &&
932 test "$(git rev-parse origin/main)" = "$(git rev-parse main)"
933 )
934 '
935
936 test_expect_success 'rename succeeds with existing remote.<target>.prune' '
937 git clone one four.four &&
938 test_when_finished git config --global --unset remote.upstream.prune &&
939 git config --global remote.upstream.prune true &&
940 git -C four.four remote rename origin upstream
941 '
942
943 test_expect_success 'remove a remote' '
944 test_config_global remote.pushDefault origin &&
945 git clone one four.five &&
946 (
947 cd four.five &&
948 git config branch.main.pushRemote origin &&
949 git remote remove origin &&
950 test -z "$(git for-each-ref refs/remotes/origin)" &&
951 test_must_fail git config branch.main.remote &&
952 test_must_fail git config branch.main.pushRemote &&
953 test "$(git config --global remote.pushDefault)" = "origin"
954 )
955 '
956
957 test_expect_success 'remove a remote removes repo remote.pushDefault' '
958 git clone one four.five.1 &&
959 (
960 cd four.five.1 &&
961 git config remote.pushDefault origin &&
962 git remote remove origin &&
963 test_must_fail git config --local remote.pushDefault
964 )
965 '
966
967 test_expect_success 'remove a remote removes repo remote.pushDefault but ignores global' '
968 test_config_global remote.pushDefault other &&
969 git clone one four.five.2 &&
970 (
971 cd four.five.2 &&
972 git config remote.pushDefault origin &&
973 git remote remove origin &&
974 test "$(git config --global remote.pushDefault)" = "other" &&
975 test_must_fail git config --local remote.pushDefault
976 )
977 '
978
979 test_expect_success 'remove a remote removes repo remote.pushDefault but keeps global' '
980 test_config_global remote.pushDefault origin &&
981 git clone one four.five.3 &&
982 (
983 cd four.five.3 &&
984 git config remote.pushDefault origin &&
985 git remote remove origin &&
986 test "$(git config --global remote.pushDefault)" = "origin" &&
987 test_must_fail git config --local remote.pushDefault
988 )
989 '
990
991 cat >remotes_origin <<EOF
992 URL: $(pwd)/one
993 Push: refs/heads/main:refs/heads/upstream
994 Push: refs/heads/next:refs/heads/upstream2
995 Pull: refs/heads/main:refs/heads/origin
996 Pull: refs/heads/next:refs/heads/origin2
997 EOF
998
999 test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
1000 git clone one five &&
1001 origin_url=$(pwd)/one &&
1002 (
1003 cd five &&
1004 git remote remove origin &&
1005 mkdir -p .git/remotes &&
1006 cat ../remotes_origin >.git/remotes/origin &&
1007 git remote rename origin origin &&
1008 test_path_is_missing .git/remotes/origin &&
1009 test "$(git config remote.origin.url)" = "$origin_url" &&
1010 cat >push_expected <<-\EOF &&
1011 refs/heads/main:refs/heads/upstream
1012 refs/heads/next:refs/heads/upstream2
1013 EOF
1014 cat >fetch_expected <<-\EOF &&
1015 refs/heads/main:refs/heads/origin
1016 refs/heads/next:refs/heads/origin2
1017 EOF
1018 git config --get-all remote.origin.push >push_actual &&
1019 git config --get-all remote.origin.fetch >fetch_actual &&
1020 test_cmp push_expected push_actual &&
1021 test_cmp fetch_expected fetch_actual
1022 )
1023 '
1024
1025 test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
1026 git clone --template= one six &&
1027 origin_url=$(pwd)/one &&
1028 (
1029 cd six &&
1030 git remote rm origin &&
1031 mkdir .git/branches &&
1032 echo "$origin_url#main" >.git/branches/origin &&
1033 git remote rename origin origin &&
1034 test_path_is_missing .git/branches/origin &&
1035 test "$(git config remote.origin.url)" = "$origin_url" &&
1036 test "$(git config remote.origin.fetch)" = "refs/heads/main:refs/heads/origin" &&
1037 test "$(git config remote.origin.push)" = "HEAD:refs/heads/main"
1038 )
1039 '
1040
1041 test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)' '
1042 git clone --template= one seven &&
1043 (
1044 cd seven &&
1045 git remote rm origin &&
1046 mkdir .git/branches &&
1047 echo "quux#foom" > .git/branches/origin &&
1048 git remote rename origin origin &&
1049 test_path_is_missing .git/branches/origin &&
1050 test "$(git config remote.origin.url)" = "quux" &&
1051 test "$(git config remote.origin.fetch)" = "refs/heads/foom:refs/heads/origin" &&
1052 test "$(git config remote.origin.push)" = "HEAD:refs/heads/foom"
1053 )
1054 '
1055
1056 test_expect_success 'remote prune to cause a dangling symref' '
1057 git clone one eight &&
1058 (
1059 cd one &&
1060 git checkout side2 &&
1061 git branch -D main
1062 ) &&
1063 (
1064 cd eight &&
1065 git remote prune origin
1066 ) >err 2>&1 &&
1067 test_i18ngrep "has become dangling" err &&
1068
1069 : And the dangling symref will not cause other annoying errors &&
1070 (
1071 cd eight &&
1072 git branch -a
1073 ) 2>err &&
1074 ! grep "points nowhere" err &&
1075 (
1076 cd eight &&
1077 test_must_fail git branch nomore origin
1078 ) 2>err &&
1079 test_i18ngrep "dangling symref" err
1080 '
1081
1082 test_expect_success 'show empty remote' '
1083 test_create_repo empty &&
1084 git clone empty empty-clone &&
1085 (
1086 cd empty-clone &&
1087 git remote show origin
1088 )
1089 '
1090
1091 test_expect_success 'remote set-branches requires a remote' '
1092 test_must_fail git remote set-branches &&
1093 test_must_fail git remote set-branches --add
1094 '
1095
1096 test_expect_success 'remote set-branches' '
1097 echo "+refs/heads/*:refs/remotes/scratch/*" >expect.initial &&
1098 sort <<-\EOF >expect.add &&
1099 +refs/heads/*:refs/remotes/scratch/*
1100 +refs/heads/other:refs/remotes/scratch/other
1101 EOF
1102 sort <<-\EOF >expect.replace &&
1103 +refs/heads/maint:refs/remotes/scratch/maint
1104 +refs/heads/main:refs/remotes/scratch/main
1105 +refs/heads/next:refs/remotes/scratch/next
1106 EOF
1107 sort <<-\EOF >expect.add-two &&
1108 +refs/heads/maint:refs/remotes/scratch/maint
1109 +refs/heads/main:refs/remotes/scratch/main
1110 +refs/heads/next:refs/remotes/scratch/next
1111 +refs/heads/seen:refs/remotes/scratch/seen
1112 +refs/heads/t/topic:refs/remotes/scratch/t/topic
1113 EOF
1114 sort <<-\EOF >expect.setup-ffonly &&
1115 refs/heads/main:refs/remotes/scratch/main
1116 +refs/heads/next:refs/remotes/scratch/next
1117 EOF
1118 sort <<-\EOF >expect.respect-ffonly &&
1119 refs/heads/main:refs/remotes/scratch/main
1120 +refs/heads/next:refs/remotes/scratch/next
1121 +refs/heads/seen:refs/remotes/scratch/seen
1122 EOF
1123
1124 git clone .git/ setbranches &&
1125 (
1126 cd setbranches &&
1127 git remote rename origin scratch &&
1128 git config --get-all remote.scratch.fetch >config-result &&
1129 sort <config-result >../actual.initial &&
1130
1131 git remote set-branches scratch --add other &&
1132 git config --get-all remote.scratch.fetch >config-result &&
1133 sort <config-result >../actual.add &&
1134
1135 git remote set-branches scratch maint main next &&
1136 git config --get-all remote.scratch.fetch >config-result &&
1137 sort <config-result >../actual.replace &&
1138
1139 git remote set-branches --add scratch seen t/topic &&
1140 git config --get-all remote.scratch.fetch >config-result &&
1141 sort <config-result >../actual.add-two &&
1142
1143 git config --unset-all remote.scratch.fetch &&
1144 git config remote.scratch.fetch \
1145 refs/heads/main:refs/remotes/scratch/main &&
1146 git config --add remote.scratch.fetch \
1147 +refs/heads/next:refs/remotes/scratch/next &&
1148 git config --get-all remote.scratch.fetch >config-result &&
1149 sort <config-result >../actual.setup-ffonly &&
1150
1151 git remote set-branches --add scratch seen &&
1152 git config --get-all remote.scratch.fetch >config-result &&
1153 sort <config-result >../actual.respect-ffonly
1154 ) &&
1155 test_cmp expect.initial actual.initial &&
1156 test_cmp expect.add actual.add &&
1157 test_cmp expect.replace actual.replace &&
1158 test_cmp expect.add-two actual.add-two &&
1159 test_cmp expect.setup-ffonly actual.setup-ffonly &&
1160 test_cmp expect.respect-ffonly actual.respect-ffonly
1161 '
1162
1163 test_expect_success 'remote set-branches with --mirror' '
1164 echo "+refs/*:refs/*" >expect.initial &&
1165 echo "+refs/heads/main:refs/heads/main" >expect.replace &&
1166 git clone --mirror .git/ setbranches-mirror &&
1167 (
1168 cd setbranches-mirror &&
1169 git remote rename origin scratch &&
1170 git config --get-all remote.scratch.fetch >../actual.initial &&
1171
1172 git remote set-branches scratch heads/main &&
1173 git config --get-all remote.scratch.fetch >../actual.replace
1174 ) &&
1175 test_cmp expect.initial actual.initial &&
1176 test_cmp expect.replace actual.replace
1177 '
1178
1179 test_expect_success 'new remote' '
1180 git remote add someremote foo &&
1181 echo foo >expect &&
1182 git config --get-all remote.someremote.url >actual &&
1183 cmp expect actual
1184 '
1185
1186 get_url_test () {
1187 cat >expect &&
1188 git remote get-url "$@" >actual &&
1189 test_cmp expect actual
1190 }
1191
1192 test_expect_success 'get-url on new remote' '
1193 echo foo | get_url_test someremote &&
1194 echo foo | get_url_test --all someremote &&
1195 echo foo | get_url_test --push someremote &&
1196 echo foo | get_url_test --push --all someremote
1197 '
1198
1199 test_expect_success 'remote set-url with locked config' '
1200 test_when_finished "rm -f .git/config.lock" &&
1201 git config --get-all remote.someremote.url >expect &&
1202 >.git/config.lock &&
1203 test_must_fail git remote set-url someremote baz &&
1204 git config --get-all remote.someremote.url >actual &&
1205 cmp expect actual
1206 '
1207
1208 test_expect_success 'remote set-url bar' '
1209 git remote set-url someremote bar &&
1210 echo bar >expect &&
1211 git config --get-all remote.someremote.url >actual &&
1212 cmp expect actual
1213 '
1214
1215 test_expect_success 'remote set-url baz bar' '
1216 git remote set-url someremote baz bar &&
1217 echo baz >expect &&
1218 git config --get-all remote.someremote.url >actual &&
1219 cmp expect actual
1220 '
1221
1222 test_expect_success 'remote set-url zot bar' '
1223 test_must_fail git remote set-url someremote zot bar &&
1224 echo baz >expect &&
1225 git config --get-all remote.someremote.url >actual &&
1226 cmp expect actual
1227 '
1228
1229 test_expect_success 'remote set-url --push zot baz' '
1230 test_must_fail git remote set-url --push someremote zot baz &&
1231 echo "YYY" >expect &&
1232 echo baz >>expect &&
1233 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1234 echo "YYY" >>actual &&
1235 git config --get-all remote.someremote.url >>actual &&
1236 cmp expect actual
1237 '
1238
1239 test_expect_success 'remote set-url --push zot' '
1240 git remote set-url --push someremote zot &&
1241 echo zot >expect &&
1242 echo "YYY" >>expect &&
1243 echo baz >>expect &&
1244 git config --get-all remote.someremote.pushurl >actual &&
1245 echo "YYY" >>actual &&
1246 git config --get-all remote.someremote.url >>actual &&
1247 cmp expect actual
1248 '
1249
1250 test_expect_success 'get-url with different urls' '
1251 echo baz | get_url_test someremote &&
1252 echo baz | get_url_test --all someremote &&
1253 echo zot | get_url_test --push someremote &&
1254 echo zot | get_url_test --push --all someremote
1255 '
1256
1257 test_expect_success 'remote set-url --push qux zot' '
1258 git remote set-url --push someremote qux zot &&
1259 echo qux >expect &&
1260 echo "YYY" >>expect &&
1261 echo baz >>expect &&
1262 git config --get-all remote.someremote.pushurl >actual &&
1263 echo "YYY" >>actual &&
1264 git config --get-all remote.someremote.url >>actual &&
1265 cmp expect actual
1266 '
1267
1268 test_expect_success 'remote set-url --push foo qu+x' '
1269 git remote set-url --push someremote foo qu+x &&
1270 echo foo >expect &&
1271 echo "YYY" >>expect &&
1272 echo baz >>expect &&
1273 git config --get-all remote.someremote.pushurl >actual &&
1274 echo "YYY" >>actual &&
1275 git config --get-all remote.someremote.url >>actual &&
1276 cmp expect actual
1277 '
1278
1279 test_expect_success 'remote set-url --push --add aaa' '
1280 git remote set-url --push --add someremote aaa &&
1281 echo foo >expect &&
1282 echo aaa >>expect &&
1283 echo "YYY" >>expect &&
1284 echo baz >>expect &&
1285 git config --get-all remote.someremote.pushurl >actual &&
1286 echo "YYY" >>actual &&
1287 git config --get-all remote.someremote.url >>actual &&
1288 cmp expect actual
1289 '
1290
1291 test_expect_success 'get-url on multi push remote' '
1292 echo foo | get_url_test --push someremote &&
1293 get_url_test --push --all someremote <<-\EOF
1294 foo
1295 aaa
1296 EOF
1297 '
1298
1299 test_expect_success 'remote set-url --push bar aaa' '
1300 git remote set-url --push someremote bar aaa &&
1301 echo foo >expect &&
1302 echo bar >>expect &&
1303 echo "YYY" >>expect &&
1304 echo baz >>expect &&
1305 git config --get-all remote.someremote.pushurl >actual &&
1306 echo "YYY" >>actual &&
1307 git config --get-all remote.someremote.url >>actual &&
1308 cmp expect actual
1309 '
1310
1311 test_expect_success 'remote set-url --push --delete bar' '
1312 git remote set-url --push --delete someremote bar &&
1313 echo foo >expect &&
1314 echo "YYY" >>expect &&
1315 echo baz >>expect &&
1316 git config --get-all remote.someremote.pushurl >actual &&
1317 echo "YYY" >>actual &&
1318 git config --get-all remote.someremote.url >>actual &&
1319 cmp expect actual
1320 '
1321
1322 test_expect_success 'remote set-url --push --delete foo' '
1323 git remote set-url --push --delete someremote foo &&
1324 echo "YYY" >expect &&
1325 echo baz >>expect &&
1326 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1327 echo "YYY" >>actual &&
1328 git config --get-all remote.someremote.url >>actual &&
1329 cmp expect actual
1330 '
1331
1332 test_expect_success 'remote set-url --add bbb' '
1333 git remote set-url --add someremote bbb &&
1334 echo "YYY" >expect &&
1335 echo baz >>expect &&
1336 echo bbb >>expect &&
1337 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1338 echo "YYY" >>actual &&
1339 git config --get-all remote.someremote.url >>actual &&
1340 cmp expect actual
1341 '
1342
1343 test_expect_success 'get-url on multi fetch remote' '
1344 echo baz | get_url_test someremote &&
1345 get_url_test --all someremote <<-\EOF
1346 baz
1347 bbb
1348 EOF
1349 '
1350
1351 test_expect_success 'remote set-url --delete .*' '
1352 test_must_fail git remote set-url --delete someremote .\* &&
1353 echo "YYY" >expect &&
1354 echo baz >>expect &&
1355 echo bbb >>expect &&
1356 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1357 echo "YYY" >>actual &&
1358 git config --get-all remote.someremote.url >>actual &&
1359 cmp expect actual
1360 '
1361
1362 test_expect_success 'remote set-url --delete bbb' '
1363 git remote set-url --delete someremote bbb &&
1364 echo "YYY" >expect &&
1365 echo baz >>expect &&
1366 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1367 echo "YYY" >>actual &&
1368 git config --get-all remote.someremote.url >>actual &&
1369 cmp expect actual
1370 '
1371
1372 test_expect_success 'remote set-url --delete baz' '
1373 test_must_fail git remote set-url --delete someremote baz &&
1374 echo "YYY" >expect &&
1375 echo baz >>expect &&
1376 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1377 echo "YYY" >>actual &&
1378 git config --get-all remote.someremote.url >>actual &&
1379 cmp expect actual
1380 '
1381
1382 test_expect_success 'remote set-url --add ccc' '
1383 git remote set-url --add someremote ccc &&
1384 echo "YYY" >expect &&
1385 echo baz >>expect &&
1386 echo ccc >>expect &&
1387 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1388 echo "YYY" >>actual &&
1389 git config --get-all remote.someremote.url >>actual &&
1390 cmp expect actual
1391 '
1392
1393 test_expect_success 'remote set-url --delete baz' '
1394 git remote set-url --delete someremote baz &&
1395 echo "YYY" >expect &&
1396 echo ccc >>expect &&
1397 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1398 echo "YYY" >>actual &&
1399 git config --get-all remote.someremote.url >>actual &&
1400 cmp expect actual
1401 '
1402
1403 test_expect_success 'extra args: setup' '
1404 # add a dummy origin so that this does not trigger failure
1405 git remote add origin .
1406 '
1407
1408 test_extra_arg () {
1409 test_expect_success "extra args: $*" "
1410 test_must_fail git remote $* bogus_extra_arg 2>actual &&
1411 test_i18ngrep '^usage:' actual
1412 "
1413 }
1414
1415 test_extra_arg add nick url
1416 test_extra_arg rename origin newname
1417 test_extra_arg remove origin
1418 test_extra_arg set-head origin main
1419 # set-branches takes any number of args
1420 test_extra_arg get-url origin newurl
1421 test_extra_arg set-url origin newurl oldurl
1422 # show takes any number of args
1423 # prune takes any number of args
1424 # update takes any number of args
1425
1426 test_expect_success 'add remote matching the "insteadOf" URL' '
1427 git config url.xyz@example.com.insteadOf backup &&
1428 git remote add backup xyz@example.com
1429 '
1430
1431 test_expect_success 'unqualified <dst> refspec DWIM and advice' '
1432 test_when_finished "(cd test && git tag -d some-tag)" &&
1433 (
1434 cd test &&
1435 git tag -a -m "Some tag" some-tag main &&
1436 for type in commit tag tree blob
1437 do
1438 if test "$type" = "blob"
1439 then
1440 oid=$(git rev-parse some-tag:file)
1441 else
1442 oid=$(git rev-parse some-tag^{$type})
1443 fi &&
1444 test_must_fail git push origin $oid:dst 2>err &&
1445 test_i18ngrep "error: The destination you" err &&
1446 test_i18ngrep "hint: Did you mean" err &&
1447 test_must_fail git -c advice.pushUnqualifiedRefName=false \
1448 push origin $oid:dst 2>err &&
1449 test_i18ngrep "error: The destination you" err &&
1450 test_i18ngrep ! "hint: Did you mean" err ||
1451 exit 1
1452 done
1453 )
1454 '
1455
1456 test_expect_success 'refs/remotes/* <src> refspec and unqualified <dst> DWIM and advice' '
1457 (
1458 cd two &&
1459 git tag -a -m "Some tag" my-tag main &&
1460 git update-ref refs/trees/my-head-tree HEAD^{tree} &&
1461 git update-ref refs/blobs/my-file-blob HEAD:file
1462 ) &&
1463 (
1464 cd test &&
1465 git config --add remote.two.fetch "+refs/tags/*:refs/remotes/tags-from-two/*" &&
1466 git config --add remote.two.fetch "+refs/trees/*:refs/remotes/trees-from-two/*" &&
1467 git config --add remote.two.fetch "+refs/blobs/*:refs/remotes/blobs-from-two/*" &&
1468 git fetch --no-tags two &&
1469
1470 test_must_fail git push origin refs/remotes/two/another:dst 2>err &&
1471 test_i18ngrep "error: The destination you" err &&
1472
1473 test_must_fail git push origin refs/remotes/tags-from-two/my-tag:dst-tag 2>err &&
1474 test_i18ngrep "error: The destination you" err &&
1475
1476 test_must_fail git push origin refs/remotes/trees-from-two/my-head-tree:dst-tree 2>err &&
1477 test_i18ngrep "error: The destination you" err &&
1478
1479 test_must_fail git push origin refs/remotes/blobs-from-two/my-file-blob:dst-blob 2>err &&
1480 test_i18ngrep "error: The destination you" err
1481 )
1482 '
1483
1484 test_done