Imported Upstream version 2.15.0
[platform/upstream/git.git] / t / t5512-ls-remote.sh
index 55fc83f..02106c9 100755 (executable)
@@ -85,8 +85,15 @@ test_expect_success 'use branch.<name>.remote if possible' '
 '
 
 test_expect_success 'confuses pattern as remote when no remote specified' '
-       cat >exp <<-\EOF &&
-       fatal: '\''refs*master'\'' does not appear to be a git repository
+       if test_have_prereq MINGW
+       then
+               # Windows does not like asterisks in pathname
+               does_not_exist=master
+       else
+               does_not_exist="refs*master"
+       fi &&
+       cat >exp <<-EOF &&
+       fatal: '\''$does_not_exist'\'' does not appear to be a git repository
        fatal: Could not read from remote repository.
 
        Please make sure you have the correct access rights
@@ -98,7 +105,7 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
        # 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_must_fail git ls-remote "$does_not_exist" >actual 2>&1 &&
        test_i18ncmp exp actual
 '
 
@@ -248,4 +255,13 @@ test_expect_success PIPE,JGIT,GIT_DAEMON 'indicate no refs in standards-complian
        test_expect_code 2 git ls-remote --exit-code git://localhost:$JGIT_DAEMON_PORT/empty.git
 '
 
+test_expect_success 'ls-remote works outside repository' '
+       # It is important for this repo to be inside the nongit
+       # area, as we want a repo name that does not include
+       # slashes (because those inhibit some of our configuration
+       # lookups).
+       nongit git init --bare dst.git &&
+       nongit git ls-remote dst.git
+'
+
 test_done