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 cat >test
/expect
<<EOF
144 Fetch URL: $(pwd)/one
148 master new (next fetch will store in remotes/origin)
150 Local branches configured for 'git pull':
151 ahead merges with remote master
152 master merges with remote master
153 octopus merges with remote topic-a
154 and with remote topic-b
155 and with remote topic-c
156 rebase rebases onto remote master
157 Local refs configured for 'git push':
158 master pushes to master (local out of date)
159 master pushes to upstream (create)
163 HEAD branch (remote HEAD is ambiguous, may be one of the following):
166 Local refs configured for 'git push':
167 ahead forces to master (fast-forwardable)
168 master pushes to another (up to date)
171 test_expect_success
'show' '
174 git config --add remote.origin.fetch refs/heads/master:refs/heads/upstream &&
176 git checkout -b ahead origin/master &&
179 git commit -m update file &&
180 git checkout master &&
181 git branch --track octopus origin/master &&
182 git branch --track rebase origin/master &&
183 git branch -d -r origin/master &&
184 git config --add remote.two.url ../two &&
185 git config --add remote.two.pushurl ../three &&
186 git config branch.rebase.rebase true &&
187 git config branch.octopus.merge "topic-a topic-b topic-c" &&
192 git commit -m update file
194 git config --add remote.origin.push : &&
195 git config --add remote.origin.push refs/heads/master:refs/heads/upstream &&
196 git config --add remote.origin.push +refs/tags/lastbackup &&
197 git config --add remote.two.push +refs/heads/ahead:refs/heads/master &&
198 git config --add remote.two.push refs/heads/master:refs/heads/another &&
199 git remote show origin two >output &&
200 git branch -d rebase octopus &&
201 test_i18ncmp expect output
205 cat >test
/expect
<<EOF
207 Fetch URL: $(pwd)/one
209 HEAD branch: (not queried)
210 Remote branches: (status not queried)
213 Local branches configured for 'git pull':
214 ahead merges with remote master
215 master merges with remote master
216 Local refs configured for 'git push' (status not queried):
217 (matching) pushes to (matching)
218 refs/heads/master pushes to refs/heads/upstream
219 refs/tags/lastbackup forces to refs/tags/lastbackup
222 test_expect_success
'show -n' '
223 mv one one.unreachable &&
226 git remote show -n origin >output &&
227 mv ../one.unreachable ../one &&
228 test_i18ncmp expect output
232 test_expect_success
'prune' '
235 git branch -m side side2
240 git remote prune origin &&
241 git rev-parse refs/remotes/origin/side2 &&
242 test_must_fail git rev-parse refs/remotes/origin/side
246 test_expect_success
'set-head --delete' '
249 git symbolic-ref refs/remotes/origin/HEAD &&
250 git remote set-head --delete origin &&
251 test_must_fail git symbolic-ref refs/remotes/origin/HEAD
255 test_expect_success
'set-head --auto' '
258 git remote set-head --auto origin &&
259 echo refs/remotes/origin/master >expect &&
260 git symbolic-ref refs/remotes/origin/HEAD >output &&
261 test_cmp expect output
265 cat >test
/expect
<<\EOF
266 error
: Multiple remote HEAD branches. Please choose one explicitly with
:
267 git remote set-head two another
268 git remote set-head two master
271 test_expect_success
'set-head --auto fails w/multiple HEADs' '
274 test_must_fail git remote set-head --auto two >output 2>&1 &&
275 test_i18ncmp expect output
279 cat >test
/expect
<<\EOF
280 refs
/remotes
/origin
/side2
283 test_expect_success
'set-head explicit' '
286 git remote set-head origin side2 &&
287 git symbolic-ref refs/remotes/origin/HEAD >output &&
288 git remote set-head origin master &&
289 test_cmp expect output
293 cat >test
/expect
<<EOF
296 * [would prune] origin/side2
299 test_expect_success
'prune --dry-run' '
302 git branch -m side2 side) &&
305 git remote prune --dry-run origin >output &&
306 git rev-parse refs/remotes/origin/side2 &&
307 test_must_fail git rev-parse refs/remotes/origin/side &&
310 git branch -m side side2) &&
311 test_i18ncmp expect output
315 test_expect_success
'add --mirror && prune' '
320 git remote add --mirror -f origin ../one
324 git branch -m side2 side
328 git rev-parse --verify refs/heads/side2 &&
329 test_must_fail git rev-parse --verify refs/heads/side &&
331 git remote prune origin &&
332 test_must_fail git rev-parse --verify refs/heads/side2 &&
333 git rev-parse --verify refs/heads/side
337 test_expect_success
'add --mirror=fetch' '
338 mkdir mirror-fetch &&
339 git init mirror-fetch/parent &&
341 cd mirror-fetch/parent &&
344 git init --bare mirror-fetch/child &&
346 cd mirror-fetch/child &&
347 git remote add --mirror=fetch -f parent ../parent
351 test_expect_success
'fetch mirrors act as mirrors during fetch' '
353 cd mirror-fetch/parent &&
355 git branch -m master renamed
358 cd mirror-fetch/child &&
360 git rev-parse --verify refs/heads/new &&
361 git rev-parse --verify refs/heads/renamed
365 test_expect_success
'fetch mirrors can prune' '
367 cd mirror-fetch/child &&
368 git remote prune parent &&
369 test_must_fail git rev-parse --verify refs/heads/master
373 test_expect_success
'fetch mirrors do not act as mirrors during push' '
375 cd mirror-fetch/parent &&
379 cd mirror-fetch/child &&
380 git branch -m renamed renamed2 &&
384 cd mirror-fetch/parent &&
385 git rev-parse --verify renamed &&
386 test_must_fail git rev-parse --verify refs/heads/renamed2
390 test_expect_success
'add fetch mirror with specific branches' '
391 git init --bare mirror-fetch/track &&
393 cd mirror-fetch/track &&
394 git remote add --mirror=fetch -t heads/new parent ../parent
398 test_expect_success
'fetch mirror respects specific branches' '
400 cd mirror-fetch/track &&
402 git rev-parse --verify refs/heads/new &&
403 test_must_fail git rev-parse --verify refs/heads/renamed
407 test_expect_success
'add --mirror=push' '
409 git init --bare mirror-push/public &&
410 git init mirror-push/private &&
412 cd mirror-push/private &&
414 git remote add --mirror=push public ../public
418 test_expect_success
'push mirrors act as mirrors during push' '
420 cd mirror-push/private &&
422 git branch -m master renamed &&
426 cd mirror-push/private &&
427 git rev-parse --verify refs/heads/new &&
428 git rev-parse --verify refs/heads/renamed &&
429 test_must_fail git rev-parse --verify refs/heads/master
433 test_expect_success
'push mirrors do not act as mirrors during fetch' '
435 cd mirror-push/public &&
436 git branch -m renamed renamed2 &&
437 git symbolic-ref HEAD refs/heads/renamed2
440 cd mirror-push/private &&
442 git rev-parse --verify refs/heads/renamed &&
443 test_must_fail git rev-parse --verify refs/heads/renamed2
447 test_expect_success
'push mirrors do not allow you to specify refs' '
448 git init mirror-push/track &&
450 cd mirror-push/track &&
451 test_must_fail git remote add --mirror=push -t new public ../public
455 test_expect_success
'add alt && prune' '
460 git remote add -f origin ../one &&
461 git config remote.alt.url ../one &&
462 git config remote.alt.fetch "+refs/heads/*:refs/remotes/origin/*"
466 git branch -m side side2
470 git rev-parse --verify refs/remotes/origin/side &&
471 test_must_fail git rev-parse --verify refs/remotes/origin/side2 &&
473 git remote prune alt &&
474 test_must_fail git rev-parse --verify refs/remotes/origin/side &&
475 git rev-parse --verify refs/remotes/origin/side2
479 cat >test
/expect
<<\EOF
483 test_expect_success
'add with reachable tags (default)' '
488 git commit -m "Foobar" &&
489 git tag -a -m "Foobar tag" foobar-tag &&
490 git reset --hard HEAD~1 &&
491 git tag -a -m "Some tag" some-tag
497 git remote add -f origin ../one &&
498 git tag -l some-tag >../test/output &&
499 git tag -l foobar-tag >>../test/output &&
500 test_must_fail git config remote.origin.tagopt
502 test_cmp test/expect test/output
505 cat >test
/expect
<<\EOF
511 test_expect_success
'add --tags' '
517 git remote add -f --tags origin ../one &&
518 git tag -l some-tag >../test/output &&
519 git tag -l foobar-tag >>../test/output &&
520 git config remote.origin.tagopt >>../test/output
522 test_cmp test/expect test/output
525 cat >test
/expect
<<\EOF
529 test_expect_success
'add --no-tags' '
535 git remote add -f --no-tags origin ../one &&
536 git tag -l some-tag >../test/output &&
537 git tag -l foobar-tag >../test/output &&
538 git config remote.origin.tagopt >>../test/output
542 git tag -d some-tag foobar-tag
544 test_cmp test/expect test/output
547 test_expect_success
'reject --no-no-tags' '
550 test_must_fail git remote add -f --no-no-tags neworigin ../one
554 cat >one
/expect
<<\EOF
562 test_expect_success
'update' '
565 git remote add drosophila ../two &&
566 git remote add apis ../mirror &&
568 git branch -r >output &&
569 test_cmp expect output
573 cat >one
/expect
<<\EOF
583 test_expect_success
'update with arguments' '
586 for b in $(git branch -r)
588 git branch -r -d $b || break
590 git remote add manduca ../mirror &&
591 git remote add megaloprepus ../mirror &&
592 git config remotes.phobaeticus "drosophila megaloprepus" &&
593 git config remotes.titanus manduca &&
594 git remote update phobaeticus titanus &&
595 git branch -r >output &&
596 test_cmp expect output
600 test_expect_success
'update --prune' '
603 git branch -m side2 side3
607 git remote update --prune &&
610 git branch -m side3 side2
612 git rev-parse refs/remotes/origin/side3 &&
613 test_must_fail git rev-parse refs/remotes/origin/side2
617 cat >one
/expect
<<-\EOF
626 test_expect_success 'update default' '
629 for b in $(git branch -r)
631 git branch -r -d $b || break
633 git config remote.drosophila.skipDefaultUpdate true &&
634 git remote update default &&
635 git branch -r >output &&
636 test_cmp expect output
640 cat >one/expect <<\EOF
646 test_expect_success 'update default (overridden, with funny whitespace)' '
649 for b in $(git branch -r)
651 git branch -r -d $b || break
653 git config remotes.default "$(printf "\t drosophila \n")" &&
654 git remote update default &&
655 git branch -r >output &&
656 test_cmp expect output
660 test_expect_success 'update (with remotes.default defined)' '
663 for b in $(git branch -r)
665 git branch -r -d $b || break
667 git config remotes.default "drosophila" &&
669 git branch -r >output &&
670 test_cmp expect output
674 test_expect_success '"remote show" does not show symbolic refs' '
675 git clone one three &&
678 git remote show origin >output &&
679 ! grep "^ *HEAD$" < output &&
680 ! grep -i stale < output
684 test_expect_success 'reject adding remote with an invalid name' '
685 test_must_fail git remote add some:url desired-name
688 # The first three test if the tracking branches are properly renamed,
689 # the last two ones check if the config is updated.
691 test_expect_success 'rename a remote' '
692 git clone one four &&
695 git remote rename origin upstream &&
696 rmdir .git/refs/remotes/origin &&
697 test "$(git symbolic-ref refs/remotes/upstream/HEAD)" = "refs/remotes/upstream/master" &&
698 test "$(git rev-parse upstream/master)" = "$(git rev-parse master)" &&
699 test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/remotes/upstream/*" &&
700 test "$(git config branch.master.remote)" = "upstream"
704 test_expect_success 'rename does not update a non-default fetch refspec' '
705 git clone one four.one &&
708 git config remote.origin.fetch +refs/heads/*:refs/heads/origin/* &&
709 git remote rename origin upstream &&
710 test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/heads/origin/*" &&
711 git rev-parse -q origin/master
715 test_expect_success 'rename a remote with name part of fetch spec' '
716 git clone one four.two &&
719 git remote rename origin remote &&
720 git remote rename remote upstream &&
721 test "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/remotes/upstream/*"
725 test_expect_success 'rename a remote with name prefix of other remote' '
726 git clone one four.three &&
729 git remote add o git://example.com/repo.git &&
730 git remote rename o upstream &&
731 test "$(git rev-parse origin/master)" = "$(git rev-parse master)"
735 cat >remotes_origin <<EOF
737 Push: refs/heads/master:refs/heads/upstream
738 Push: refs/heads/next:refs/heads/upstream2
739 Pull: refs/heads/master:refs/heads/origin
740 Pull: refs/heads/next:refs/heads/origin2
743 test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
744 git clone one five &&
745 origin_url=$(pwd)/one &&
748 git remote remove origin &&
749 mkdir -p .git/remotes &&
750 cat ../remotes_origin >.git/remotes/origin &&
751 git remote rename origin origin &&
752 test_path_is_missing .git/remotes/origin &&
753 test "$(git config remote.origin.url)" = "$origin_url" &&
754 cat >push_expected <<-\
EOF &&
755 refs/heads/master:refs/heads/upstream
756 refs/heads/next:refs/heads/upstream2
758 cat >fetch_expected <<-\EOF &&
759 refs/heads/master:refs/heads/origin
760 refs/heads/next:refs/heads/origin2
762 git config --get-all remote.origin.push >push_actual &&
763 git config --get-all remote.origin.fetch >fetch_actual &&
764 test_cmp push_expected push_actual &&
765 test_cmp fetch_expected fetch_actual
769 test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
771 origin_url=$(pwd)/one &&
774 git remote rm origin &&
775 echo "$origin_url" >.git/branches/origin &&
776 git remote rename origin origin &&
777 test_path_is_missing .git/branches/origin &&
778 test "$(git config remote.origin.url)" = "$origin_url" &&
779 test "$(git config remote.origin.fetch)" = "refs/heads/master:refs/heads/origin" &&
780 test "$(git config remote.origin.push)" = "HEAD:refs/heads/master"
784 test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)' '
785 git clone one seven &&
788 git remote rm origin &&
789 echo "quux#foom" > .git/branches/origin &&
790 git remote rename origin origin &&
791 test_path_is_missing .git/branches/origin &&
792 test "$(git config remote.origin.url)" = "quux" &&
793 test "$(git config remote.origin.fetch)" = "refs/heads/foom:refs/heads/origin"
794 test "$(git config remote.origin.push)" = "HEAD:refs/heads/foom"
798 test_expect_success 'remote prune to cause a dangling symref' '
799 git clone one eight &&
802 git checkout side2 &&
807 git remote prune origin
809 test_i18ngrep "has become dangling" err &&
811 : And the dangling symref will not cause other annoying errors &&
816 ! grep "points nowhere" err &&
819 test_must_fail git branch nomore origin
821 grep "dangling symref" err
824 test_expect_success 'show empty remote' '
825 test_create_repo empty &&
826 git clone empty empty-clone &&
829 git remote show origin
833 test_expect_success 'remote set-branches requires a remote' '
834 test_must_fail git remote set-branches &&
835 test_must_fail git remote set-branches --add
838 test_expect_success 'remote set-branches' '
839 echo "+refs/heads/*:refs/remotes/scratch/*" >expect.initial &&
840 sort <<-\EOF >expect.add &&
841 +refs/heads/*:refs/remotes/scratch/*
842 +refs/heads/other:refs/remotes/scratch/other
844 sort <<-\EOF >expect.replace &&
845 +refs/heads/maint:refs/remotes/scratch/maint
846 +refs/heads/master:refs/remotes/scratch/master
847 +refs/heads/next:refs/remotes/scratch/next
849 sort <<-\EOF >expect.add-two &&
850 +refs/heads/maint:refs/remotes/scratch/maint
851 +refs/heads/master:refs/remotes/scratch/master
852 +refs/heads/next:refs/remotes/scratch/next
853 +refs/heads/pu:refs/remotes/scratch/pu
854 +refs/heads/t/topic:refs/remotes/scratch/t/topic
856 sort <<-\EOF >expect.setup-ffonly &&
857 refs/heads/master:refs/remotes/scratch/master
858 +refs/heads/next:refs/remotes/scratch/next
860 sort <<-\EOF >expect.respect-ffonly &&
861 refs/heads/master:refs/remotes/scratch/master
862 +refs/heads/next:refs/remotes/scratch/next
863 +refs/heads/pu:refs/remotes/scratch/pu
866 git clone .git/ setbranches &&
869 git remote rename origin scratch &&
870 git config --get-all remote.scratch.fetch >config-result &&
871 sort <config-result >../actual.initial &&
873 git remote set-branches scratch --add other &&
874 git config --get-all remote.scratch.fetch >config-result &&
875 sort <config-result >../actual.add &&
877 git remote set-branches scratch maint master next &&
878 git config --get-all remote.scratch.fetch >config-result &&
879 sort <config-result >../actual.replace &&
881 git remote set-branches --add scratch pu t/topic &&
882 git config --get-all remote.scratch.fetch >config-result &&
883 sort <config-result >../actual.add-two &&
885 git config --unset-all remote.scratch.fetch &&
886 git config remote.scratch.fetch \
887 refs/heads/master:refs/remotes/scratch/master &&
888 git config --add remote.scratch.fetch \
889 +refs/heads/next:refs/remotes/scratch/next &&
890 git config --get-all remote.scratch.fetch >config-result &&
891 sort <config-result >../actual.setup-ffonly &&
893 git remote set-branches --add scratch pu &&
894 git config --get-all remote.scratch.fetch >config-result &&
895 sort <config-result >../actual.respect-ffonly
897 test_cmp expect.initial actual.initial &&
898 test_cmp expect.add actual.add &&
899 test_cmp expect.replace actual.replace &&
900 test_cmp expect.add-two actual.add-two &&
901 test_cmp expect.setup-ffonly actual.setup-ffonly &&
902 test_cmp expect.respect-ffonly actual.respect-ffonly
905 test_expect_success 'remote set-branches with --mirror' '
906 echo "+refs/*:refs/*" >expect.initial &&
907 echo "+refs/heads/master:refs/heads/master" >expect.replace &&
908 git clone --mirror .git/ setbranches-mirror &&
910 cd setbranches-mirror &&
911 git remote rename origin scratch &&
912 git config --get-all remote.scratch.fetch >../actual.initial &&
914 git remote set-branches scratch heads/master &&
915 git config --get-all remote.scratch.fetch >../actual.replace
917 test_cmp expect.initial actual.initial &&
918 test_cmp expect.replace actual.replace
921 test_expect_success 'new remote' '
922 git remote add someremote foo &&
924 git config --get-all remote.someremote.url >actual &&
928 test_expect_success 'remote set-url bar' '
929 git remote set-url someremote bar &&
931 git config --get-all remote.someremote.url >actual &&
935 test_expect_success 'remote set-url baz bar' '
936 git remote set-url someremote baz bar &&
938 git config --get-all remote.someremote.url >actual &&
942 test_expect_success 'remote set-url zot bar' '
943 test_must_fail git remote set-url someremote zot bar &&
945 git config --get-all remote.someremote.url >actual &&
949 test_expect_success 'remote set-url --push zot baz' '
950 test_must_fail git remote set-url --push someremote zot baz &&
951 echo "YYY" >expect &&
953 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
954 echo "YYY" >>actual &&
955 git config --get-all remote.someremote.url >>actual &&
959 test_expect_success 'remote set-url --push zot' '
960 git remote set-url --push someremote zot &&
962 echo "YYY" >>expect &&
964 git config --get-all remote.someremote.pushurl >actual &&
965 echo "YYY" >>actual &&
966 git config --get-all remote.someremote.url >>actual &&
970 test_expect_success 'remote set-url --push qux zot' '
971 git remote set-url --push someremote qux zot &&
973 echo "YYY" >>expect &&
975 git config --get-all remote.someremote.pushurl >actual &&
976 echo "YYY" >>actual &&
977 git config --get-all remote.someremote.url >>actual &&
981 test_expect_success 'remote set-url --push foo qu+x' '
982 git remote set-url --push someremote foo qu+x &&
984 echo "YYY" >>expect &&
986 git config --get-all remote.someremote.pushurl >actual &&
987 echo "YYY" >>actual &&
988 git config --get-all remote.someremote.url >>actual &&
992 test_expect_success 'remote set-url --push --add aaa' '
993 git remote set-url --push --add someremote aaa &&
996 echo "YYY" >>expect &&
998 git config --get-all remote.someremote.pushurl >actual &&
999 echo "YYY" >>actual &&
1000 git config --get-all remote.someremote.url >>actual &&
1004 test_expect_success 'remote set-url --push bar aaa' '
1005 git remote set-url --push someremote bar aaa &&
1007 echo bar >>expect &&
1008 echo "YYY" >>expect &&
1009 echo baz >>expect &&
1010 git config --get-all remote.someremote.pushurl >actual &&
1011 echo "YYY" >>actual &&
1012 git config --get-all remote.someremote.url >>actual &&
1016 test_expect_success 'remote set-url --push --delete bar' '
1017 git remote set-url --push --delete someremote bar &&
1019 echo "YYY" >>expect &&
1020 echo baz >>expect &&
1021 git config --get-all remote.someremote.pushurl >actual &&
1022 echo "YYY" >>actual &&
1023 git config --get-all remote.someremote.url >>actual &&
1027 test_expect_success 'remote set-url --push --delete foo' '
1028 git remote set-url --push --delete someremote foo &&
1029 echo "YYY" >expect &&
1030 echo baz >>expect &&
1031 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1032 echo "YYY" >>actual &&
1033 git config --get-all remote.someremote.url >>actual &&
1037 test_expect_success 'remote set-url --add bbb' '
1038 git remote set-url --add someremote bbb &&
1039 echo "YYY" >expect &&
1040 echo baz >>expect &&
1041 echo bbb >>expect &&
1042 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1043 echo "YYY" >>actual &&
1044 git config --get-all remote.someremote.url >>actual &&
1048 test_expect_success 'remote set-url --delete .*' '
1049 test_must_fail git remote set-url --delete someremote .\* &&
1050 echo "YYY" >expect &&
1051 echo baz >>expect &&
1052 echo bbb >>expect &&
1053 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1054 echo "YYY" >>actual &&
1055 git config --get-all remote.someremote.url >>actual &&
1059 test_expect_success 'remote set-url --delete bbb' '
1060 git remote set-url --delete someremote bbb &&
1061 echo "YYY" >expect &&
1062 echo baz >>expect &&
1063 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1064 echo "YYY" >>actual &&
1065 git config --get-all remote.someremote.url >>actual &&
1069 test_expect_success 'remote set-url --delete baz' '
1070 test_must_fail git remote set-url --delete someremote baz &&
1071 echo "YYY" >expect &&
1072 echo baz >>expect &&
1073 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1074 echo "YYY" >>actual &&
1075 git config --get-all remote.someremote.url >>actual &&
1079 test_expect_success 'remote set-url --add ccc' '
1080 git remote set-url --add someremote ccc &&
1081 echo "YYY" >expect &&
1082 echo baz >>expect &&
1083 echo ccc >>expect &&
1084 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1085 echo "YYY" >>actual &&
1086 git config --get-all remote.someremote.url >>actual &&
1090 test_expect_success 'remote set-url --delete baz' '
1091 git remote set-url --delete someremote baz &&
1092 echo "YYY" >expect &&
1093 echo ccc >>expect &&
1094 test_must_fail git config --get-all remote.someremote.pushurl >actual &&
1095 echo "YYY" >>actual &&
1096 git config --get-all remote.someremote.url >>actual &&
1100 test_expect_success 'extra args: setup' '
1101 # add a dummy origin so that this does not trigger failure
1102 git remote add origin .
1106 test_expect_success "extra args: $*" "
1107 test_must_fail git remote $* bogus_extra_arg 2>actual &&
1108 grep '^usage:' actual
1112 test_extra_arg add nick url
1113 test_extra_arg rename origin newname
1114 test_extra_arg remove origin
1115 test_extra_arg set-head origin master
1116 # set-branches takes any number of args
1117 test_extra_arg set-url origin newurl oldurl
1118 # show takes any number of args
1119 # prune takes any number of args
1120 # update takes any number of args