3 test_description
='git remote porcelain-ish'
14 git commit
-m "Initial" &&
15 git checkout
-b side
&&
19 git commit
-m "Second" &&
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
30 check_remote_track
() {
31 actual
=$
(git remote show
"$1" |
sed -ne 's|^ \(.*\) tracked$|\1|p')
33 tokens_match
"$*" "$actual"
36 check_tracking_branch
() {
38 r
=$
(git for-each-ref
"--format=%(refname)" |
39 sed -ne "s|^refs/remotes/$1/||p") &&
41 tokens_match
"$*" "$r"
44 test_expect_success setup
'
45 setup_repository one &&
46 setup_repository two &&
54 test_expect_success C_LOCALE_OUTPUT
'remote information for the origin' '
57 tokens_match origin "$(git remote)" &&
58 check_remote_track origin master side &&
59 check_tracking_branch origin HEAD master side
63 test_expect_success
'add another remote' '
66 git remote add -f second ../two &&
67 tokens_match "origin second" "$(git remote)" &&
68 check_tracking_branch second master side another &&
69 git for-each-ref "--format=%(refname)" refs/remotes |
70 sed -e "/^refs\/remotes\/origin\//d" \
71 -e "/^refs\/remotes\/second\//d" >actual &&
73 test_cmp expect actual
77 test_expect_success C_LOCALE_OUTPUT
'check remote-tracking' '
80 check_remote_track origin master side &&
81 check_remote_track second master side another
85 test_expect_success
'remote forces tracking branches' '
88 case $(git config remote.second.fetch) in
95 test_expect_success
'remove remote' '
98 git symbolic-ref refs/remotes/second/HEAD refs/remotes/second/master &&
103 test_expect_success C_LOCALE_OUTPUT
'remove remote' '
106 tokens_match origin "$(git remote)" &&
107 check_remote_track origin master side &&
108 git for-each-ref "--format=%(refname)" refs/remotes |
109 sed -e "/^refs\/remotes\/origin\//d" >actual &&
111 test_cmp expect actual
115 test_expect_success
'remove remote protects local branches' '
118 cat >expect1 <<-\EOF &&
119 Note: A branch outside the refs/remotes/ hierarchy was not removed;
123 cat >expect2 <<-\EOF &&
124 Note: Some branches outside the refs/remotes/ hierarchy were not removed;
126 git branch -d foobranch
130 git config --add remote.oops.fetch "+refs/*:refs/*" &&
131 git remote remove oops 2>actual1 &&
132 git branch foobranch &&
133 git config --add remote.oops.fetch "+refs/*:refs/*" &&
134 git remote rm oops 2>actual2 &&
135 git branch -d foobranch &&
137 test_i18ncmp expect1 actual1 &&
138 test_i18ncmp expect2 actual2
142 test_expect_success
'remove errors out early when deleting non-existent branch' '
145 echo "fatal: No such remote: foo" >expect &&
146 test_must_fail git remote rm foo 2>actual &&
147 test_i18ncmp expect actual
151 test_expect_success
'rename errors out early when deleting non-existent branch' '
154 echo "fatal: No such remote: foo" >expect &&
155 test_must_fail git remote rename foo bar 2>actual &&
156 test_i18ncmp expect actual
160 cat >test
/expect
<<EOF
162 Fetch URL: $(pwd)/one
166 master new (next fetch will store in remotes/origin)
168 Local branches configured for 'git pull':
169 ahead merges with remote master
170 master merges with remote master
171 octopus merges with remote topic-a
172 and with remote topic-b
173 and with remote topic-c
174 rebase rebases onto remote master
175 Local refs configured for 'git push':
176 master pushes to master (local out of date)
177 master pushes to upstream (create)
182 Local refs configured for 'git push':
183 ahead forces to master (fast-forwardable)
184 master pushes to another (up to date)
187 test_expect_success
'show' '
190 git config --add remote.origin.fetch refs/heads/master:refs/heads/upstream &&
192 git checkout -b ahead origin/master &&
195 git commit -m update file &&
196 git checkout master &&
197 git branch --track octopus origin/master &&
198 git branch --track rebase origin/master &&
199 git branch -d -r origin/master &&
200 git config --add remote.two.url ../two &&
201 git config --add remote.two.pushurl ../three &&
202 git config branch.rebase.rebase true &&
203 git config branch.octopus.merge "topic-a topic-b topic-c" &&
208 git commit -m update file
210 git config --add remote.origin.push : &&
211 git config --add remote.origin.push refs/heads/master:refs/heads/upstream &&
212 git config --add remote.origin.push +refs/tags/lastbackup &&
213 git config --add remote.two.push +refs/heads/ahead:refs/heads/master &&
214 git config --add remote.two.push refs/heads/master:refs/heads/another &&
215 git remote show origin two >output &&
216 git branch -d rebase octopus &&
217 test_i18ncmp expect output
221 cat >test
/expect
<<EOF
223 Fetch URL: $(pwd)/one
225 HEAD branch: (not queried)
226 Remote branches: (status not queried)
229 Local branches configured for 'git pull':
230 ahead merges with remote master
231 master merges with remote master
232 Local refs configured for 'git push' (status not queried):
233 (matching) pushes to (matching)
234 refs/heads/master pushes to refs/heads/upstream
235 refs/tags/lastbackup forces to refs/tags/lastbackup
238 test_expect_success
'show -n' '
239 mv one one.unreachable &&
242 git remote show -n origin >output &&
243 mv ../one.unreachable ../one &&
244 test_i18ncmp expect output
248 test_expect_success
'prune' '
251 git branch -m side side2
256 git remote prune origin &&
257 git rev-parse refs/remotes/origin/side2 &&
258 test_must_fail git rev-parse refs/remotes/origin/side
262 test_expect_success
'set-head --delete' '
265 git symbolic-ref refs/remotes/origin/HEAD &&
266 git remote set-head --delete origin &&
267 test_must_fail git symbolic-ref refs/remotes/origin/HEAD
271 test_expect_success
'set-head --auto' '
274 git remote set-head --auto origin &&
275 echo refs/remotes/origin/master >expect &&
276 git symbolic-ref refs/remotes/origin/HEAD >output &&
277 test_cmp expect output
281 test_expect_success
'set-head --auto has no problem w/multiple HEADs' '
284 git fetch two "refs/heads/*:refs/remotes/two/*" &&
285 git remote set-head --auto two >output 2>&1 &&
286 echo "two/HEAD set to master" >expect &&
287 test_i18ncmp expect output
291 cat >test
/expect
<<\EOF
292 refs
/remotes
/origin
/side2
295 test_expect_success
'set-head explicit' '
298 git remote set-head origin side2 &&
299 git symbolic-ref refs/remotes/origin/HEAD >output &&
300 git remote set-head origin master &&
301 test_cmp expect output
305 cat >test
/expect
<<EOF
308 * [would prune] origin/side2
311 test_expect_success
'prune --dry-run' '
314 git branch -m side2 side) &&
317 git remote prune --dry-run origin >output &&
318 git rev-parse refs/remotes/origin/side2 &&
319 test_must_fail git rev-parse refs/remotes/origin/side &&
322 git branch -m side side2) &&
323 test_i18ncmp expect output
327 test_expect_success
'add --mirror && prune' '
332 git remote add --mirror -f origin ../one
336 git branch -m side2 side
340 git rev-parse --verify refs/heads/side2 &&
341 test_must_fail git rev-parse --verify refs/heads/side &&
343 git remote prune origin &&
344 test_must_fail git rev-parse --verify refs/heads/side2 &&
345 git rev-parse --verify refs/heads/side
349 test_expect_success
'add --mirror=fetch' '
350 mkdir mirror-fetch &&
351 git init mirror-fetch/parent &&
353 cd mirror-fetch/parent &&
356 git init --bare mirror-fetch/child &&
358 cd mirror-fetch/child &&
359 git remote add --mirror=fetch -f parent ../parent
363 test_expect_success
'fetch mirrors act as mirrors during fetch' '
365 cd mirror-fetch/parent &&
367 git branch -m master renamed
370 cd mirror-fetch/child &&
372 git rev-parse --verify refs/heads/new &&
373 git rev-parse --verify refs/heads/renamed
377 test_expect_success
'fetch mirrors can prune' '
379 cd mirror-fetch/child &&
380 git remote prune parent &&
381 test_must_fail git rev-parse --verify refs/heads/master
385 test_expect_success
'fetch mirrors do not act as mirrors during push' '
387 cd mirror-fetch/parent &&
391 cd mirror-fetch/child &&
392 git branch -m renamed renamed2 &&
396 cd mirror-fetch/parent &&
397 git rev-parse --verify renamed &&
398 test_must_fail git rev-parse --verify refs/heads/renamed2
402 test_expect_success
'add fetch mirror with specific branches' '
403 git init --bare mirror-fetch/track &&
405 cd mirror-fetch/track &&
406 git remote add --mirror=fetch -t heads/new parent ../parent
410 test_expect_success
'fetch mirror respects specific branches' '
412 cd mirror-fetch/track &&
414 git rev-parse --verify refs/heads/new &&
415 test_must_fail git rev-parse --verify refs/heads/renamed
419 test_expect_success
'add --mirror=push' '
421 git init --bare mirror-push/public &&
422 git init mirror-push/private &&
424 cd mirror-push/private &&
426 git remote add --mirror=push public ../public
430 test_expect_success
'push mirrors act as mirrors during push' '
432 cd mirror-push/private &&
434 git branch -m master renamed &&
438 cd mirror-push/private &&
439 git rev-parse --verify refs/heads/new &&
440 git rev-parse --verify refs/heads/renamed &&
441 test_must_fail git rev-parse --verify refs/heads/master
445 test_expect_success
'push mirrors do not act as mirrors during fetch' '
447 cd mirror-push/public &&
448 git branch -m renamed renamed2 &&
449 git symbolic-ref HEAD refs/heads/renamed2
452 cd mirror-push/private &&
454 git rev-parse --verify refs/heads/renamed &&
455 test_must_fail git rev-parse --verify refs/heads/renamed2
459 test_expect_success
'push mirrors do not allow you to specify refs' '
460 git init mirror-push/track &&
462 cd mirror-push/track &&
463 test_must_fail git remote add --mirror=push -t new public ../public
467 test_expect_success
'add alt && prune' '
472 git remote add -f origin ../one &&
473 git config remote.alt.url ../one &&
474 git config remote.alt.fetch "+refs/heads/*:refs/remotes/origin/*"
478 git branch -m side side2
482 git rev-parse --verify refs/remotes/origin/side &&
483 test_must_fail git rev-parse --verify refs/remotes/origin/side2 &&
485 git remote prune alt &&
486 test_must_fail git rev-parse --verify refs/remotes/origin/side &&
487 git rev-parse --verify refs/remotes/origin/side2
491 cat >test
/expect
<<\EOF
495 test_expect_success
'add with reachable tags (default)' '
500 git commit -m "Foobar" &&
501 git tag -a -m "Foobar tag" foobar-tag &&
502 git reset --hard HEAD~1 &&
503 git tag -a -m "Some tag" some-tag
509 git remote add -f origin ../one &&
510 git tag -l some-tag >../test/output &&
511 git tag -l foobar-tag >>../test/output &&
512 test_must_fail git config remote.origin.tagopt
514 test_cmp test/expect test/output
517 cat >test
/expect
<<\EOF
523 test_expect_success
'add --tags' '
529 git remote add -f --tags origin ../one &&
530 git tag -l some-tag >../test/output &&
531 git tag -l foobar-tag >>../test/output &&
532 git config remote.origin.tagopt >>../test/output
534 test_cmp test/expect test/output
537 cat >test
/expect
<<\EOF
541 test_expect_success
'add --no-tags' '
547 git remote add -f --no-tags origin ../one &&
548 git tag -l some-tag >../test/output &&
549 git tag -l foobar-tag >../test/output &&
550 git config remote.origin.tagopt >>../test/output
554 git tag -d some-tag foobar-tag
556 test_cmp test/expect test/output
559 test_expect_success
'reject --no-no-tags' '
562 test_must_fail git remote add -f --no-no-tags neworigin ../one
566 cat >one
/expect
<<\EOF
574 test_expect_success
'update' '
577 git remote add drosophila ../two &&
578 git remote add apis ../mirror &&
580 git branch -r >output &&
581 test_cmp expect output
585 cat >one
/expect
<<\EOF
595 test_expect_success
'update with arguments' '
598 for b in $(git branch -r)
600 git branch -r -d $b || exit 1
602 git remote add manduca ../mirror &&
603 git remote add megaloprepus ../mirror &&
604 git config remotes.phobaeticus "drosophila megaloprepus" &&
605 git config remotes.titanus manduca &&
606 git remote update phobaeticus titanus &&
607 git branch -r >output &&
608 test_cmp expect output
612 test_expect_success
'update --prune' '
615 git branch -m side2 side3
619 git remote update --prune &&
622 git branch -m side3 side2
624 git rev-parse refs/remotes/origin/side3 &&
625 test_must_fail git rev-parse refs/remotes/origin/side2
629 cat >one
/expect
<<-\EOF
638 test_expect_success 'update default' '
641 for b in $(git branch -r)
643 git branch -r -d $b || exit 1
645 git config remote.drosophila.skipDefaultUpdate true &&
646 git remote update default &&
647 git branch -r >output &&
648 test_cmp expect output
652 cat >one/expect <<\EOF
658 test_expect_success 'update default (overridden, with funny whitespace)' '
661 for b in $(git branch -r)
663 git branch -r -d $b || exit 1
665 git config remotes.default "$(printf "\t drosophila \n")" &&
666 git remote update default &&
667 git branch -r >output &&
668 test_cmp expect output
672 test_expect_success 'update (with remotes.default defined)' '
675 for b in $(git branch -r)
677 git branch -r -d $b || exit 1
679 git config remotes.default "drosophila" &&
681 git branch -r >output &&
682 test_cmp expect output
686 test_expect_success '"remote show" does not show symbolic refs' '
687 git clone one three &&
690 git remote show origin >output &&
691 ! grep "^ *HEAD$" < output &&
692 ! grep -i stale < output
696 test_expect_success 'reject adding remote with an invalid name' '
697 test_must_fail git remote add some:url desired-name
700 # The first three test if the tracking branches are properly renamed,
701 # the last two ones check if the config is updated.
703 test_expect_success 'rename a remote' '
704 git clone one four &&
707 git remote rename origin upstream &&
708 rmdir .git/refs/remotes/origin &&
709 test "$(git symbolic-ref refs/remotes/upstream/HEAD)" = "refs/remotes/upstream/master" &&
710 test "$(git rev-parse upstream/master)" = "$(git rev-parse master)" &&
711 test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/remotes/upstream/*" &&
712 test "$(git config branch.master.remote)" = "upstream"
716 test_expect_success 'rename does not update a non-default fetch refspec' '
717 git clone one four.one &&
720 git config remote.origin.fetch +refs/heads/*:refs/heads/origin/* &&
721 git remote rename origin upstream &&
722 test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/heads/origin/*" &&
723 git rev-parse -q origin/master
727 test_expect_success 'rename a remote with name part of fetch spec' '
728 git clone one four.two &&
731 git remote rename origin remote &&
732 git remote rename remote upstream &&
733 test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/remotes/upstream/*"
737 test_expect_success 'rename a remote with name prefix of other remote' '
738 git clone one four.three &&
741 git remote add o git://example.com/repo.git &&
742 git remote rename o upstream &&
743 test "$(git rev-parse origin/master)" = "$(git rev-parse master)"
747 cat >remotes_origin <<EOF
749 Push: refs/heads/master:refs/heads/upstream
750 Push: refs/heads/next:refs/heads/upstream2
751 Pull: refs/heads/master:refs/heads/origin
752 Pull: refs/heads/next:refs/heads/origin2
755 test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
756 git clone one five &&
757 origin_url=$(pwd)/one &&
760 git remote remove origin &&
761 mkdir -p .git/remotes &&
762 cat ../remotes_origin >.git/remotes/origin &&
763 git remote rename origin origin &&
764 test_path_is_missing .git/remotes/origin &&
765 test "$(git config remote.origin.url)" = "$origin_url" &&
766 cat >push_expected <<-\
EOF &&
767 refs/heads/master:refs/heads/upstream
768 refs/heads/next:refs/heads/upstream2
770 cat >fetch_expected <<-\EOF &&
771 refs/heads/master:refs/heads/origin
772 refs/heads/next:refs/heads/origin2
774 git config --get-all remote.origin.push >push_actual &&
775 git config --get-all remote.origin.fetch >fetch_actual &&
776 test_cmp push_expected push_actual &&
777 test_cmp fetch_expected fetch_actual
781 test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
783 origin_url=$(pwd)/one &&
786 git remote rm origin &&
787 echo "$origin_url" >.git/branches/origin &&
788 git remote rename origin origin &&
789 test_path_is_missing .git/branches/origin &&
790 test "$(git config remote.origin.url)" = "$origin_url" &&
791 test "$(git config remote.origin.fetch)" = "refs/heads/master:refs/heads/origin" &&
792 test "$(git config remote.origin.push)" = "HEAD:refs/heads/master"
796 test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)' '
797 git clone one seven &&
800 git remote rm origin &&
801 echo "quux#foom" > .git/branches/origin &&
802 git remote rename origin origin &&
803 test_path_is_missing .git/branches/origin &&
804 test "$(git config remote.origin.url)" = "quux" &&
805 test "$(git config remote.origin.fetch)" = "refs/heads/foom:refs/heads/origin"
806 test "$(git config remote.origin.push)" = "HEAD:refs/heads/foom"
810 test_expect_success 'remote prune to cause a dangling symref' '
811 git clone one eight &&
814 git checkout side2 &&
819 git remote prune origin
821 test_i18ngrep "has become dangling" err &&
823 : And the dangling symref will not cause other annoying errors &&
828 ! grep "points nowhere" err &&
831 test_must_fail git branch nomore origin
833 grep "dangling symref" err
836 test_expect_success 'show empty remote' '
837 test_create_repo empty &&
838 git clone empty empty-clone &&
841 git remote show origin
845 test_expect_success 'remote set-branches requires a remote' '
846 test_must_fail git remote set-branches &&
847 test_must_fail git remote set-branches --add
850 test_expect_success 'remote set-branches' '
851 echo "+refs/heads/*:refs/remotes/scratch/*" >expect.initial &&
852 sort <<-\EOF >expect.add &&
853 +refs/heads/*:refs/remotes/scratch/*
854 +refs/heads/other:refs/remotes/scratch/other
856 sort <<-\EOF >expect.replace &&
857 +refs/heads/maint:refs/remotes/scratch/maint
858 +refs/heads/master:refs/remotes/scratch/master
859 +refs/heads/next:refs/remotes/scratch/next
861 sort <<-\EOF >expect.add-two &&
862 +refs/heads/maint:refs/remotes/scratch/maint
863 +refs/heads/master:refs/remotes/scratch/master
864 +refs/heads/next:refs/remotes/scratch/next
865 +refs/heads/pu:refs/remotes/scratch/pu
866 +refs/heads/t/topic:refs/remotes/scratch/t/topic
868 sort <<-\EOF >expect.setup-ffonly &&
869 refs/heads/master:refs/remotes/scratch/master
870 +refs/heads/next:refs/remotes/scratch/next
872 sort <<-\EOF >expect.respect-ffonly &&
873 refs/heads/master:refs/remotes/scratch/master
874 +refs/heads/next:refs/remotes/scratch/next
875 +refs/heads/pu:refs/remotes/scratch/pu
878 git clone .git/ setbranches &&
881 git remote rename origin scratch &&
882 git config --get-all remote.scratch.fetch >config-result &&
883 sort <config-result >../actual.initial &&
885 git remote set-branches scratch --add other &&
886 git config --get-all remote.scratch.fetch >config-result &&
887 sort <config-result >../actual.add &&
889 git remote set-branches scratch maint master next &&
890 git config --get-all remote.scratch.fetch >config-result &&
891 sort <config-result >../actual.replace &&
893 git remote set-branches --add scratch pu t/topic &&
894 git config --get-all remote.scratch.fetch >config-result &&
895 sort <config-result >../actual.add-two &&
897 git config --unset-all remote.scratch.fetch &&
898 git config remote.scratch.fetch \
899 refs/heads/master:refs/remotes/scratch/master &&
900 git config --add remote.scratch.fetch \
901 +refs/heads/next:refs/remotes/scratch/next &&
902 git config --get-all remote.scratch.fetch >config-result &&
903 sort <config-result >../actual.setup-ffonly &&
905 git remote set-branches --add scratch pu &&
906 git config --get-all remote.scratch.fetch >config-result &&
907 sort <config-result >../actual.respect-ffonly
909 test_cmp expect.initial actual.initial &&
910 test_cmp expect.add actual.add &&
911 test_cmp expect.replace actual.replace &&
912 test_cmp expect.add-two actual.add-two &&
913 test_cmp expect.setup-ffonly actual.setup-ffonly &&
914 test_cmp expect.respect-ffonly actual.respect-ffonly
917 test_expect_success 'remote set-branches with --mirror' '
918 echo "+refs/*:refs/*" >expect.initial &&
919 echo "+refs/heads/master:refs/heads/master" >expect.replace &&
920 git clone --mirror .git/ setbranches-mirror &&
922 cd setbranches-mirror &&
923 git remote rename origin scratch &&
924 git config --get-all remote.scratch.fetch >../actual.initial &&
926 git remote set-branches scratch heads/master &&
927 git config --get-all remote.scratch.fetch >../actual.replace
929 test_cmp expect.initial actual.initial &&
930 test_cmp expect.replace actual.replace
933 test_expect_success 'new remote' '
934 git remote add someremote foo &&
936 git config --get-all remote.someremote.url >actual &&
942 git remote get-url "$@" >actual &&
943 test_cmp expect actual
946 test_expect_success 'get-url on new remote' '
947 echo foo | get_url_test someremote &&
948 echo foo | get_url_test --all someremote &&
949 echo foo | get_url_test --push someremote &&
950 echo foo | get_url_test --push --all someremote
953 test_expect_success 'remote set-url bar' '
954 git remote set-url someremote bar &&
956 git config --get-all remote.someremote.url >actual &&
960 test_expect_success 'remote set-url baz bar' '
961 git remote set-url someremote baz bar &&
963 git config --get-all remote.someremote.url >actual &&
967 test_expect_success 'remote set-url zot bar' '
968 test_must_fail git remote set-url someremote zot bar &&
970 git config --get-all remote.someremote.url >actual &&
974 test_expect_success 'remote set-url --push zot baz' '
975 test_must_fail git remote set-url --push someremote zot baz &&
976 echo "YYY" >expect &&
978 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
979 echo "YYY" >>actual &&
980 git config --get-all remote.someremote.url >>actual &&
984 test_expect_success 'remote set-url --push zot' '
985 git remote set-url --push someremote zot &&
987 echo "YYY" >>expect &&
989 git config --get-all remote.someremote.pushurl >actual &&
990 echo "YYY" >>actual &&
991 git config --get-all remote.someremote.url >>actual &&
995 test_expect_success 'get-url with different urls' '
996 echo baz | get_url_test someremote &&
997 echo baz | get_url_test --all someremote &&
998 echo zot | get_url_test --push someremote &&
999 echo zot | get_url_test --push --all someremote
1002 test_expect_success 'remote set-url --push qux zot' '
1003 git remote set-url --push someremote qux zot &&
1005 echo "YYY" >>expect &&
1006 echo baz >>expect &&
1007 git config --get-all remote.someremote.pushurl >actual &&
1008 echo "YYY" >>actual &&
1009 git config --get-all remote.someremote.url >>actual &&
1013 test_expect_success 'remote set-url --push foo qu+x' '
1014 git remote set-url --push someremote foo qu+x &&
1016 echo "YYY" >>expect &&
1017 echo baz >>expect &&
1018 git config --get-all remote.someremote.pushurl >actual &&
1019 echo "YYY" >>actual &&
1020 git config --get-all remote.someremote.url >>actual &&
1024 test_expect_success 'remote set-url --push --add aaa' '
1025 git remote set-url --push --add someremote aaa &&
1027 echo aaa >>expect &&
1028 echo "YYY" >>expect &&
1029 echo baz >>expect &&
1030 git config --get-all remote.someremote.pushurl >actual &&
1031 echo "YYY" >>actual &&
1032 git config --get-all remote.someremote.url >>actual &&
1036 test_expect_success 'get-url on multi push remote' '
1037 echo foo | get_url_test --push someremote &&
1038 get_url_test --push --all someremote <<-\EOF
1044 test_expect_success 'remote set-url --push bar aaa' '
1045 git remote set-url --push someremote bar aaa &&
1047 echo bar >>expect &&
1048 echo "YYY" >>expect &&
1049 echo baz >>expect &&
1050 git config --get-all remote.someremote.pushurl >actual &&
1051 echo "YYY" >>actual &&
1052 git config --get-all remote.someremote.url >>actual &&
1056 test_expect_success 'remote set-url --push --delete bar' '
1057 git remote set-url --push --delete someremote bar &&
1059 echo "YYY" >>expect &&
1060 echo baz >>expect &&
1061 git config --get-all remote.someremote.pushurl >actual &&
1062 echo "YYY" >>actual &&
1063 git config --get-all remote.someremote.url >>actual &&
1067 test_expect_success 'remote set-url --push --delete foo' '
1068 git remote set-url --push --delete someremote foo &&
1069 echo "YYY" >expect &&
1070 echo baz >>expect &&
1071 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1072 echo "YYY" >>actual &&
1073 git config --get-all remote.someremote.url >>actual &&
1077 test_expect_success 'remote set-url --add bbb' '
1078 git remote set-url --add someremote bbb &&
1079 echo "YYY" >expect &&
1080 echo baz >>expect &&
1081 echo bbb >>expect &&
1082 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1083 echo "YYY" >>actual &&
1084 git config --get-all remote.someremote.url >>actual &&
1088 test_expect_success 'get-url on multi fetch remote' '
1089 echo baz | get_url_test someremote &&
1090 get_url_test --all someremote <<-\EOF
1096 test_expect_success 'remote set-url --delete .*' '
1097 test_must_fail git remote set-url --delete someremote .\* &&
1098 echo "YYY" >expect &&
1099 echo baz >>expect &&
1100 echo bbb >>expect &&
1101 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1102 echo "YYY" >>actual &&
1103 git config --get-all remote.someremote.url >>actual &&
1107 test_expect_success 'remote set-url --delete bbb' '
1108 git remote set-url --delete someremote bbb &&
1109 echo "YYY" >expect &&
1110 echo baz >>expect &&
1111 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1112 echo "YYY" >>actual &&
1113 git config --get-all remote.someremote.url >>actual &&
1117 test_expect_success 'remote set-url --delete baz' '
1118 test_must_fail git remote set-url --delete someremote baz &&
1119 echo "YYY" >expect &&
1120 echo baz >>expect &&
1121 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1122 echo "YYY" >>actual &&
1123 git config --get-all remote.someremote.url >>actual &&
1127 test_expect_success 'remote set-url --add ccc' '
1128 git remote set-url --add someremote ccc &&
1129 echo "YYY" >expect &&
1130 echo baz >>expect &&
1131 echo ccc >>expect &&
1132 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1133 echo "YYY" >>actual &&
1134 git config --get-all remote.someremote.url >>actual &&
1138 test_expect_success 'remote set-url --delete baz' '
1139 git remote set-url --delete someremote baz &&
1140 echo "YYY" >expect &&
1141 echo ccc >>expect &&
1142 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1143 echo "YYY" >>actual &&
1144 git config --get-all remote.someremote.url >>actual &&
1148 test_expect_success 'extra args: setup' '
1149 # add a dummy origin so that this does not trigger failure
1150 git remote add origin .
1154 test_expect_success "extra args: $*" "
1155 test_must_fail git remote $* bogus_extra_arg 2>actual &&
1156 grep '^usage:' actual
1160 test_extra_arg add nick url
1161 test_extra_arg rename origin newname
1162 test_extra_arg remove origin
1163 test_extra_arg set-head origin master
1164 # set-branches takes any number of args
1165 test_extra_arg get-url origin newurl
1166 test_extra_arg set-url origin newurl oldurl
1167 # show takes any number of args
1168 # prune takes any number of args
1169 # update takes any number of args
1171 test_expect_success 'add remote matching the "insteadOf" URL' '
1172 git config url.xyz@example.com.insteadOf backup &&
1173 git remote add backup xyz@example.com