diff options
author | Tay Ray Chuan <rctay89@gmail.com> | 2010-05-12 01:20:23 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-05-11 22:55:44 -0700 |
commit | cefb2a5e39b165146aee3b093872721cc1155a87 (patch) | |
tree | 363db940a175c13b4524bacc2867ed6b6587cac9 /t/t5512-ls-remote.sh | |
parent | 9c00de5a3135c8f7273668d4013c225d48d47861 (diff) | |
download | git-cefb2a5e39b165146aee3b093872721cc1155a87.tar.gz git-cefb2a5e39b165146aee3b093872721cc1155a87.tar.xz |
ls-remote: print URL when no repo is specified
After 9c00de5 (ls-remote: fall-back to default remotes when no remote
specified), when no repository is specified, ls-remote may use
the URL/remote in the config "branch.<name>.remote" or the remote
"origin"; it may not be immediately obvious to the user which was used.
In such cases, print a simple "From <URL>" line to indicate which
repository was used. This message is similar to git-fetch's, and is
printed to stderr to avoid breaking existing scripts that depend on
ls-remote's output behaviour.
It can also be disabled with -q/--quiet.
Modify tests related to falling back on default remotes to check for
this as well, and add a test to check for suppression of the message.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5512-ls-remote.sh')
-rwxr-xr-x | t/t5512-ls-remote.sh | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh index 3cf1b3da4..d1912351d 100755 --- a/t/t5512-ls-remote.sh +++ b/t/t5512-ls-remote.sh @@ -57,12 +57,24 @@ test_expect_success 'dies when no remote specified and no default remotes found' test_expect_success 'use "origin" when no remote specified' ' - git remote add origin "$(pwd)/.git" && - git ls-remote >actual && + URL="$(pwd)/.git" && + echo "From $URL" >exp_err && + + git remote add origin "$URL" && + git ls-remote 2>actual_err >actual && + + test_cmp exp_err actual_err && test_cmp expected.all actual ' +test_expect_success 'suppress "From <url>" with -q' ' + + git ls-remote -q 2>actual_err && + test_must_fail test_cmp exp_err actual_err + +' + test_expect_success 'use branch.<name>.remote if possible' ' # @@ -78,10 +90,14 @@ test_expect_success 'use branch.<name>.remote if possible' ' git show-ref | sed -e "s/ / /" ) >exp && - git remote add other other.git && + URL="other.git" && + echo "From $URL" >exp_err && + + git remote add other $URL && git config branch.master.remote other && - git ls-remote >actual && + git ls-remote 2>actual_err >actual && + test_cmp exp_err actual_err && test_cmp exp actual ' |