diff options
| author | Brandon Williams <bmwill@google.com> | 2018-04-23 15:46:24 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-04-24 11:24:40 +0900 |
| commit | 5e3548ef161d4d284e35cf5f5d6a181ba4fe707b (patch) | |
| tree | a1e5175546417ed701dbe109b683142b95111261 /builtin/fetch.c | |
| parent | ls-remote: send server options when using protocol v2 (diff) | |
| download | git-5e3548ef161d4d284e35cf5f5d6a181ba4fe707b.tar.gz git-5e3548ef161d4d284e35cf5f5d6a181ba4fe707b.zip | |
fetch: send server options when using protocol v2
Teach fetch 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 performing a fetch communicating 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 <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch.c')
| -rw-r--r-- | builtin/fetch.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index 7ee83ac0f8..5a6f6b2dca 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -62,6 +62,7 @@ static int shown_url = 0; static int refmap_alloc, refmap_nr; static const char **refmap_array; static struct list_objects_filter_options filter_options; +static struct string_list server_options = STRING_LIST_INIT_DUP; static int git_fetch_config(const char *k, const char *v, void *cb) { @@ -170,6 +171,7 @@ static struct option builtin_fetch_options[] = { N_("accept refs that update .git/shallow")), { OPTION_CALLBACK, 0, "refmap", NULL, N_("refmap"), N_("specify fetch refmap"), PARSE_OPT_NONEG, parse_refmap_arg }, + OPT_STRING_LIST('o', "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"), @@ -1417,6 +1419,9 @@ static int fetch_one(struct remote *remote, int argc, const char **argv, int pru } } + if (server_options.nr) + gtransport->server_options = &server_options; + sigchain_push_common(unlock_pack_on_signal); atexit(unlock_pack); refspec = parse_fetch_refspec(ref_nr, refs); |
