I created v2 by rewriting jt/clone-server-option, so you'll see some Reviewed-by lines and Signed-off-by lines with another name than mine. Changes from v1: - Broke long line. (DUP->NODUP was already done by Junio in jt/clone-server-option, so you don't see it in the range-diff below.) - Warn if server-option is specified but not sent to the server (in fetch and clone). - Document that server's handling of server-option is server-specific. These patches are on maint, matching jt/clone-server-option, but should apply cleanly on master too. Jonathan Tan (2): transport: warn if server options are unsupported clone: send server options when using protocol v2 Documentation/fetch-options.txt | 3 ++- Documentation/git-clone.txt | 8 +++++++ builtin/clone.c | 6 ++++++ t/t5702-protocol-v2.sh | 38 +++++++++++++++++++++++++++++++++ transport.c | 8 +++++++ 5 files changed, 62 insertions(+), 1 deletion(-) Range-diff against v1: -: ---------- > 1: af3cc05324 transport: warn if server options are unsupported 1: 90ce94e039 ! 2: 142c25abd2 clone: send server options when using protocol v2 @@ -11,10 +11,27 @@ 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. + Signed-off-by: Jonathan Tan <jonathantanmy@xxxxxxxxxx> Reviewed-by: Jonathan Nieder <jrnieder@xxxxxxxxx> Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> + diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt + --- a/Documentation/fetch-options.txt + +++ b/Documentation/fetch-options.txt +@@ + --server-option=<option>:: + Transmit the given string to the server when communicating using + protocol version 2. The given string must not contain a NUL or LF +- character. ++ character. The server's handling of server options, including ++ unknown ones, is server-specific. + When multiple `--server-option=<option>` are given, they are all + sent to the other side in the order listed on the command line. + + diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt --- a/Documentation/git-clone.txt +++ b/Documentation/git-clone.txt @@ -25,7 +42,8 @@ +--server-option=<option>:: + Transmit the given string to the server when communicating using + protocol version 2. The given string must not contain a NUL or LF -+ character. ++ character. The server's handling of server options, including ++ unknown ones, is server-specific. + When multiple `--server-option=<option>` are given, they are all + sent to the other side in the order listed on the command line. + @@ -48,8 +66,8 @@ N_("separate git dir from working tree")), OPT_STRING_LIST('c', "config", &option_config, N_("key=value"), N_("set config inside the new repository")), -+ OPT_STRING_LIST(0, "server-option", &server_options, N_("server-specific"), -+ N_("option to transmit")), ++ OPT_STRING_LIST(0, "server-option", &server_options, ++ N_("server-specific"), N_("option to transmit")), OPT_SET_INT('4', "ipv4", &family, N_("use IPv4 addresses only"), TRANSPORT_FAMILY_IPV4), OPT_SET_INT('6', "ipv6", &family, N_("use IPv6 addresses only"), @@ -68,7 +86,7 @@ --- a/t/t5702-protocol-v2.sh +++ b/t/t5702-protocol-v2.sh @@ - grep "server-option=world" log + grep "Ignoring server options" err ' +test_expect_success 'server-options are sent when cloning' ' @@ -81,6 +99,16 @@ + 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" && ++ ++ GIT_TEST_PROTOCOL_VERSION=0 git -c protocol.version=0 \ ++ clone --server-option=hello --server-option=world \ ++ "file://$(pwd)/file_parent" myclone 2>err && ++ ++ grep "Ignoring server options" err ++' + test_expect_success 'upload-pack respects config using protocol v2' ' git init server && -- 2.21.0.392.gf8f6787159e-goog