summaryrefslogtreecommitdiff
path: root/t/t5702-protocol-v2.sh
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2018-03-15 10:31:24 -0700
committerJunio C Hamano <gitster@pobox.com>2018-03-15 12:01:08 -0700
commitb4be74105febef5c6235e1e2f1e468e76166cad8 (patch)
treeeb61d2519d6f2ef3e3014dc1fd0d754a6b0a2934 /t/t5702-protocol-v2.sh
parent1af8ae1cfa44a3f3c3f1efb7f9ebe68bc0ce7578 (diff)
downloadgit-b4be74105febef5c6235e1e2f1e468e76166cad8.tar.gz
ls-remote: pass ref prefixes when requesting a remote's refs
Construct an argv_array of ref prefixes based on the patterns supplied via the command line and pass them to 'transport_get_remote_refs()' to be used when communicating protocol v2 so that the server can limit the ref advertisement based on those prefixes. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5702-protocol-v2.sh')
-rwxr-xr-xt/t5702-protocol-v2.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index dc5f813beb..562610fd25 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -32,6 +32,19 @@ test_expect_success 'list refs with git:// using protocol v2' '
test_cmp actual expect
'
+test_expect_success 'ref advertisment is filtered with ls-remote using protocol v2' '
+ test_when_finished "rm -f log" &&
+
+ GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
+ ls-remote "$GIT_DAEMON_URL/parent" master >actual &&
+
+ cat >expect <<-EOF &&
+ $(git -C "$daemon_parent" rev-parse refs/heads/master)$(printf "\t")refs/heads/master
+ EOF
+
+ test_cmp actual expect
+'
+
stop_git_daemon
# Test protocol v2 with 'file://' transport
@@ -54,4 +67,17 @@ test_expect_success 'list refs with file:// using protocol v2' '
test_cmp actual expect
'
+test_expect_success 'ref advertisment is filtered with ls-remote using protocol v2' '
+ test_when_finished "rm -f log" &&
+
+ GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
+ ls-remote "file://$(pwd)/file_parent" master >actual &&
+
+ cat >expect <<-EOF &&
+ $(git -C file_parent rev-parse refs/heads/master)$(printf "\t")refs/heads/master
+ EOF
+
+ test_cmp actual expect
+'
+
test_done