summaryrefslogtreecommitdiff
path: root/t/t5512-ls-remote.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t5512-ls-remote.sh')
-rwxr-xr-xt/t5512-ls-remote.sh26
1 files changed, 25 insertions, 1 deletions
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index bc5703f..cd9e606 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -260,7 +260,7 @@ test_lazy_prereq GIT_DAEMON '
# This test spawns a daemon, so run it only if the user would be OK with
# testing with git-daemon.
test_expect_success PIPE,JGIT,GIT_DAEMON 'indicate no refs in standards-compliant empty remote' '
- JGIT_DAEMON_PORT=${JGIT_DAEMON_PORT-${this_test#t}} &&
+ test_set_port JGIT_DAEMON_PORT &&
JGIT_DAEMON_PID= &&
git init --bare empty.git &&
>empty.git/git-daemon-export-ok &&
@@ -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