diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2019-04-12 12:51:22 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-18 10:53:51 +0900 |
commit | 6e98305985555ced61971ca0170dd976554193c0 (patch) | |
tree | b7203706dc8aade4cb29b5cc9d7f4f6e174cbe9a /t/t5702-protocol-v2.sh | |
parent | 35eb8240b0849b8d2cf675f1bed5d4dbf977372e (diff) | |
download | git-6e98305985555ced61971ca0170dd976554193c0.tar.gz |
clone: send server options when using protocol v2
Commit 5e3548ef16 ("fetch: send server options when using protocol v2",
2018-04-24) taught "fetch" the ability to send server options when using
protocol v2, but not "clone". This ability is triggered by "-o" or
"--server-option".
Teach "clone" the same ability, except that because "clone" already
has "-o" for another parameter, teach "clone" only to receive
"--server-option".
Explain in the documentation, both for clone and for fetch, that server
handling of server options are server-specific. This is similar to
receive-pack's handling of push options - currently, they are just sent
to hooks to interpret as they see fit.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5702-protocol-v2.sh')
-rwxr-xr-x | t/t5702-protocol-v2.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh index f8912211e0..9b048f6c8b 100755 --- a/t/t5702-protocol-v2.sh +++ b/t/t5702-protocol-v2.sh @@ -270,6 +270,28 @@ test_expect_success 'warn if using server-option with fetch with legacy protocol test_i18ngrep "server options require protocol version 2 or later" err ' +test_expect_success 'server-options are sent when cloning' ' + test_when_finished "rm -rf log myclone" && + + GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \ + clone --server-option=hello --server-option=world \ + "file://$(pwd)/file_parent" myclone && + + grep "server-option=hello" log && + grep "server-option=world" log +' + +test_expect_success 'warn if using server-option with clone with legacy protocol' ' + test_when_finished "rm -rf myclone" && + + test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 git -c protocol.version=0 \ + clone --server-option=hello --server-option=world \ + "file://$(pwd)/file_parent" myclone 2>err && + + test_i18ngrep "see protocol.version in" err && + test_i18ngrep "server options require protocol version 2 or later" err +' + test_expect_success 'upload-pack respects config using protocol v2' ' git init server && write_script server/.git/hook <<-\EOF && |