Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2018-04-24 01:46:23 +0300
committerJunio C Hamano <gitster@pobox.com>2018-04-24 05:24:40 +0300
commitff473221b4d6cf0894ba47370492d853a36c024d (patch)
tree50b103baec013524704188718b2c46433ce4ce10 /connect.c
parentecc3e5342de203fa2d84c4a49a46aaa87289534b (diff)
ls-remote: send server options when using protocol v2
Teach ls-remote 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 querying for the remote end's refs 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 'connect.c')
-rw-r--r--connect.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/connect.c b/connect.c
index 54971166ac..3000768c75 100644
--- a/connect.c
+++ b/connect.c
@@ -408,7 +408,8 @@ out:
struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
struct ref **list, int for_push,
- const struct argv_array *ref_prefixes)
+ const struct argv_array *ref_prefixes,
+ const struct string_list *server_options)
{
int i;
*list = NULL;
@@ -419,6 +420,12 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
if (server_supports_v2("agent", 0))
packet_write_fmt(fd_out, "agent=%s", git_user_agent_sanitized());
+ if (server_options && server_options->nr &&
+ server_supports_v2("server-option", 1))
+ for (i = 0; i < server_options->nr; i++)
+ packet_write_fmt(fd_out, "server-option=%s",
+ server_options->items[i].string);
+
packet_delim(fd_out);
/* When pushing we don't want to request the peeled tags */
if (!for_push)