From ff473221b4d6cf0894ba47370492d853a36c024d Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Mon, 23 Apr 2018 15:46:23 -0700 Subject: 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 Signed-off-by: Junio C Hamano --- t/t5702-protocol-v2.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't/t5702-protocol-v2.sh') 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" && -- cgit v1.2.3