diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-05-08 18:37:25 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-05-08 18:37:25 +0300 |
commit | 6d3df8ef01b95539539cd5b22304eff27ea1322b (patch) | |
tree | c5caa63baa46af04fded5b616e9b41b1fe362f92 /t | |
parent | ea2dab1abbf14bfa7dd5299c9bb86d0f70aae019 (diff) | |
parent | 6e98305985555ced61971ca0170dd976554193c0 (diff) |
Merge branch 'jt/clone-server-option'
"git clone" learned a new --server-option option when talking over
the protocol version 2.
* jt/clone-server-option:
clone: send server options when using protocol v2
transport: die if server options are unsupported
Diffstat (limited to 't')
-rwxr-xr-x | t/t5702-protocol-v2.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh index a089659337..dbb4cf8881 100755 --- a/t/t5702-protocol-v2.sh +++ b/t/t5702-protocol-v2.sh @@ -182,6 +182,13 @@ test_expect_success 'server-options are sent when using ls-remote' ' grep "server-option=world" log ' +test_expect_success 'warn if using server-option with ls-remote with legacy protocol' ' + test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 git -c protocol.version=0 \ + ls-remote -o hello -o world "file://$(pwd)/file_parent" master 2>err && + + test_i18ngrep "see protocol.version in" err && + test_i18ngrep "server options require protocol version 2 or later" err +' test_expect_success 'clone with file:// using protocol v2' ' test_when_finished "rm -f log" && @@ -251,6 +258,40 @@ test_expect_success 'server-options are sent when fetching' ' grep "server-option=world" log ' +test_expect_success 'warn if using server-option with fetch with legacy protocol' ' + test_when_finished "rm -rf temp_child" && + + git init temp_child && + + test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 git -C temp_child -c protocol.version=0 \ + fetch -o hello -o world "file://$(pwd)/file_parent" master 2>err && + + test_i18ngrep "see protocol.version in" err && + 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 && |