diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-05-08 22:37:28 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-05-08 22:37:28 -0700 |
commit | 909376a1c9078b7bb7b420113efa956b130e8809 (patch) | |
tree | 5710d5b444a0254759e02ffec8ee44de8fa5cabc /t | |
parent | 3cc9caadf738c3b2cf7aa46364be173751912a10 (diff) | |
parent | 9c00de5a3135c8f7273668d4013c225d48d47861 (diff) | |
download | git-909376a1c9078b7bb7b420113efa956b130e8809.tar.gz git-909376a1c9078b7bb7b420113efa956b130e8809.tar.xz |
Merge branch 'rc/ls-remote-default'
* rc/ls-remote-default:
ls-remote: fall-back to default remotes when no remote specified
Diffstat (limited to 't')
-rwxr-xr-x | t/t5512-ls-remote.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh index 1dd8eed5b..3cf1b3da4 100755 --- a/t/t5512-ls-remote.sh +++ b/t/t5512-ls-remote.sh @@ -49,4 +49,62 @@ test_expect_success 'ls-remote self' ' ' +test_expect_success 'dies when no remote specified and no default remotes found' ' + + test_must_fail git ls-remote + +' + +test_expect_success 'use "origin" when no remote specified' ' + + git remote add origin "$(pwd)/.git" && + git ls-remote >actual && + test_cmp expected.all actual + +' + +test_expect_success 'use branch.<name>.remote if possible' ' + + # + # Test that we are indeed using branch.<name>.remote, not "origin", even + # though the "origin" remote has been set. + # + + # setup a new remote to differentiate from "origin" + git clone . other.git && + ( + cd other.git && + echo "$(git rev-parse HEAD) HEAD" + git show-ref | sed -e "s/ / /" + ) >exp && + + git remote add other other.git && + git config branch.master.remote other && + + git ls-remote >actual && + test_cmp exp actual + +' + +cat >exp <<EOF +fatal: 'refs*master' does not appear to be a git repository +fatal: The remote end hung up unexpectedly +EOF +test_expect_success 'confuses pattern as remote when no remote specified' ' + # + # Do not expect "git ls-remote <pattern>" to work; ls-remote, correctly, + # confuses <pattern> for <remote>. Although ugly, this behaviour is akin + # to the confusion of refspecs for remotes by git-fetch and git-push, + # eg: + # + # $ git fetch branch + # + + # We could just as easily have used "master"; the "*" emphasizes its + # role as a pattern. + test_must_fail git ls-remote refs*master >actual 2>&1 && + test_cmp exp actual + +' + test_done |