summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Brandon Williams <bmwill@google.com>2018-04-23 15:46:23 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-04-24 11:24:40 +0900
commitff473221b4d6cf0894ba47370492d853a36c024d (patch)
tree50b103baec013524704188718b2c46433ce4ce10 /t
parentserve: introduce the server-option capability (diff)
downloadtgif-ff473221b4d6cf0894ba47370492d853a36c024d.tar.xz
ls-remote: send server options when using protocol v2
Teach ls-remote to optionally accept server options by specifying them on the cmdline via '-o' or '--server-option'. These server options are sent to the remote end when querying for the remote end's refs using protocol version 2. If communicating using a protocol other than v2 the provided options are ignored and not sent to the remote end. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t5702-protocol-v2.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index 56f7c3c326..71ef1aee17 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -154,6 +154,22 @@ test_expect_success 'ref advertisment is filtered with ls-remote using protocol
test_cmp actual expect
'
+test_expect_success 'server-options are sent when using ls-remote' '
+ test_when_finished "rm -f log" &&
+
+ GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
+ ls-remote -o hello -o world "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 &&
+ grep "server-option=hello" log &&
+ grep "server-option=world" log
+'
+
+
test_expect_success 'clone with file:// using protocol v2' '
test_when_finished "rm -f log" &&