merge-recursive: demonstrate an incorrect conflict with submodule
[git/dscho.git] / t / t5512-ls-remote.sh
blob3cf1b3da40a8d99631fabaa2cce4ff2b6d1b52ac
1 #!/bin/sh
3 test_description='git ls-remote'
5 . ./test-lib.sh
7 test_expect_success setup '
9 >file &&
10 git add file &&
11 test_tick &&
12 git commit -m initial &&
13 git tag mark &&
14 git show-ref --tags -d | sed -e "s/ / /" >expected.tag &&
16 echo "$(git rev-parse HEAD) HEAD"
17 git show-ref -d | sed -e "s/ / /"
18 ) >expected.all &&
20 git remote add self "$(pwd)/.git"
24 test_expect_success 'ls-remote --tags .git' '
26 git ls-remote --tags .git >actual &&
27 test_cmp expected.tag actual
31 test_expect_success 'ls-remote .git' '
33 git ls-remote .git >actual &&
34 test_cmp expected.all actual
38 test_expect_success 'ls-remote --tags self' '
40 git ls-remote --tags self >actual &&
41 test_cmp expected.tag actual
45 test_expect_success 'ls-remote self' '
47 git ls-remote self >actual &&
48 test_cmp expected.all actual
52 test_expect_success 'dies when no remote specified and no default remotes found' '
54 test_must_fail git ls-remote
58 test_expect_success 'use "origin" when no remote specified' '
60 git remote add origin "$(pwd)/.git" &&
61 git ls-remote >actual &&
62 test_cmp expected.all actual
66 test_expect_success 'use branch.<name>.remote if possible' '
69 # Test that we are indeed using branch.<name>.remote, not "origin", even
70 # though the "origin" remote has been set.
73 # setup a new remote to differentiate from "origin"
74 git clone . other.git &&
76 cd other.git &&
77 echo "$(git rev-parse HEAD) HEAD"
78 git show-ref | sed -e "s/ / /"
79 ) >exp &&
81 git remote add other other.git &&
82 git config branch.master.remote other &&
84 git ls-remote >actual &&
85 test_cmp exp actual
89 cat >exp <<EOF
90 fatal: 'refs*master' does not appear to be a git repository
91 fatal: The remote end hung up unexpectedly
92 EOF
93 test_expect_success 'confuses pattern as remote when no remote specified' '
95 # Do not expect "git ls-remote <pattern>" to work; ls-remote, correctly,
96 # confuses <pattern> for <remote>. Although ugly, this behaviour is akin
97 # to the confusion of refspecs for remotes by git-fetch and git-push,
98 # eg:
100 # $ git fetch branch
103 # We could just as easily have used "master"; the "*" emphasizes its
104 # role as a pattern.
105 test_must_fail git ls-remote refs*master >actual 2>&1 &&
106 test_cmp exp actual
110 test_done