From: Junio C Hamano Date: Mon, 22 Feb 2016 21:15:01 +0000 (-0800) Subject: Merge branch 'js/git-remote-add-url-insteadof-test' X-Git-Tag: v2.8.0-rc0~39 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4091558cfe00ed7b27313ff6a55b5994ce766270?hp=-c Merge branch 'js/git-remote-add-url-insteadof-test' * js/git-remote-add-url-insteadof-test: t5505: 'remote add x y' should work when url.y.insteadOf = x --- 4091558cfe00ed7b27313ff6a55b5994ce766270 diff --combined t/t5505-remote.sh index 1a8e3b81c8,8ca0b0e4b5..0dcc752076 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@@ -51,6 -51,11 +51,11 @@@ test_expect_success setup git clone one test ' + test_expect_success 'add remote whose URL agrees with url.<...>.insteadOf' ' + test_config url.git@host.com:team/repo.git.insteadOf myremote && + git remote add myremote git@host.com:team/repo.git + ' + test_expect_success C_LOCALE_OUTPUT 'remote information for the origin' ' ( cd test && @@@ -85,7 -90,7 +90,7 @@@ test_expect_success C_LOCALE_OUTPUT 'ch test_expect_success 'remote forces tracking branches' ' ( cd test && - case `git config remote.second.fetch` in + case $(git config remote.second.fetch) in +*) true ;; *) false ;; esac @@@ -579,7 -584,7 +584,7 @@@ test_expect_success 'update with argume cd one && for b in $(git branch -r) do - git branch -r -d $b || break + git branch -r -d $b || exit 1 done && git remote add manduca ../mirror && git remote add megaloprepus ../mirror && @@@ -622,7 -627,7 +627,7 @@@ test_expect_success 'update default' cd one && for b in $(git branch -r) do - git branch -r -d $b || break + git branch -r -d $b || exit 1 done && git config remote.drosophila.skipDefaultUpdate true && git remote update default && @@@ -642,7 -647,7 +647,7 @@@ test_expect_success 'update default (ov cd one && for b in $(git branch -r) do - git branch -r -d $b || break + git branch -r -d $b || exit 1 done && git config remotes.default "$(printf "\t drosophila \n")" && git remote update default && @@@ -656,7 -661,7 +661,7 @@@ test_expect_success 'update (with remot cd one && for b in $(git branch -r) do - git branch -r -d $b || break + git branch -r -d $b || exit 1 done && git config remotes.default "drosophila" && git remote update && @@@ -919,19 -924,6 +924,19 @@@ test_expect_success 'new remote' cmp expect actual ' +get_url_test () { + cat >expect && + git remote get-url "$@" >actual && + test_cmp expect actual +} + +test_expect_success 'get-url on new remote' ' + echo foo | get_url_test someremote && + echo foo | get_url_test --all someremote && + echo foo | get_url_test --push someremote && + echo foo | get_url_test --push --all someremote +' + test_expect_success 'remote set-url bar' ' git remote set-url someremote bar && echo bar >expect && @@@ -974,13 -966,6 +979,13 @@@ test_expect_success 'remote set-url --p cmp expect actual ' +test_expect_success 'get-url with different urls' ' + echo baz | get_url_test someremote && + echo baz | get_url_test --all someremote && + echo zot | get_url_test --push someremote && + echo zot | get_url_test --push --all someremote +' + test_expect_success 'remote set-url --push qux zot' ' git remote set-url --push someremote qux zot && echo qux >expect && @@@ -1015,14 -1000,6 +1020,14 @@@ test_expect_success 'remote set-url --p cmp expect actual ' +test_expect_success 'get-url on multi push remote' ' + echo foo | get_url_test --push someremote && + get_url_test --push --all someremote <<-\EOF + foo + aaa + EOF +' + test_expect_success 'remote set-url --push bar aaa' ' git remote set-url --push someremote bar aaa && echo foo >expect && @@@ -1067,14 -1044,6 +1072,14 @@@ test_expect_success 'remote set-url --a cmp expect actual ' +test_expect_success 'get-url on multi fetch remote' ' + echo baz | get_url_test someremote && + get_url_test --all someremote <<-\EOF + baz + bbb + EOF +' + test_expect_success 'remote set-url --delete .*' ' test_must_fail git remote set-url --delete someremote .\* && echo "YYY" >expect && @@@ -1144,15 -1113,9 +1149,15 @@@ test_extra_arg rename origin newnam test_extra_arg remove origin test_extra_arg set-head origin master # set-branches takes any number of args +test_extra_arg get-url origin newurl test_extra_arg set-url origin newurl oldurl # show takes any number of args # prune takes any number of args # update takes any number of args +test_expect_success 'add remote matching the "insteadOf" URL' ' + git config url.xyz@example.com.insteadOf backup && + git remote add backup xyz@example.com +' + test_done