]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5512-ls-remote.sh
Merge branch 'md/list-lazy-objects-fix'
[thirdparty/git.git] / t / t5512-ls-remote.sh
index bc5703ff9ba166b928199abf3085ff55a8fc09f1..32e722db2ed96f14b6ca4b0fe53636c719f57eb5 100755 (executable)
@@ -302,4 +302,28 @@ test_expect_success 'ls-remote works outside repository' '
        nongit git ls-remote dst.git
 '
 
+test_expect_success 'ls-remote --sort fails gracefully outside repository' '
+       # Use a sort key that requires access to the referenced objects.
+       nongit test_must_fail git ls-remote --sort=authordate "$TRASH_DIRECTORY" 2>err &&
+       test_i18ngrep "^fatal: not a git repository, but the field '\''authordate'\'' requires access to object data" err
+'
+
+test_expect_success 'ls-remote patterns work with all protocol versions' '
+       git for-each-ref --format="%(objectname)        %(refname)" \
+               refs/heads/master refs/remotes/origin/master >expect &&
+       git -c protocol.version=1 ls-remote . master >actual.v1 &&
+       test_cmp expect actual.v1 &&
+       git -c protocol.version=2 ls-remote . master >actual.v2 &&
+       test_cmp expect actual.v2
+'
+
+test_expect_success 'ls-remote prefixes work with all protocol versions' '
+       git for-each-ref --format="%(objectname)        %(refname)" \
+               refs/heads/ refs/tags/ >expect &&
+       git -c protocol.version=1 ls-remote --heads --tags . >actual.v1 &&
+       test_cmp expect actual.v1 &&
+       git -c protocol.version=2 ls-remote --heads --tags . >actual.v2 &&
+       test_cmp expect actual.v2
+'
+
 test_done