From 6e98305985555ced61971ca0170dd976554193c0 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Fri, 12 Apr 2019 12:51:22 -0700 Subject: 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 Reviewed-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- builtin/clone.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'builtin') diff --git a/builtin/clone.c b/builtin/clone.c index 50bde99618..31a47d190a 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -66,6 +66,7 @@ static int option_dissociate; static int max_jobs = -1; static struct string_list option_recurse_submodules = STRING_LIST_INIT_NODUP; static struct list_objects_filter_options filter_options; +static struct string_list server_options = STRING_LIST_INIT_NODUP; static int recurse_submodules_cb(const struct option *opt, const char *arg, int unset) @@ -137,6 +138,8 @@ static struct option builtin_clone_options[] = { 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_SET_INT('4', "ipv4", &family, N_("use IPv4 addresses only"), TRANSPORT_FAMILY_IPV4), OPT_SET_INT('6', "ipv6", &family, N_("use IPv6 addresses only"), @@ -1136,6 +1139,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix) transport_set_option(transport, TRANS_OPT_UPLOADPACK, option_upload_pack); + if (server_options.nr) + transport->server_options = &server_options; + if (filter_options.choice) { struct strbuf expanded_filter_spec = STRBUF_INIT; expand_list_objects_filter_spec(&filter_options, -- cgit v1.2.3