remote-curl: allow push options

Teach remote-curl to understand push options and to be able to convey
them across HTTP.

Signed-off-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brandon Williams
2017-03-22 15:22:00 -07:00
committed by Junio C Hamano
parent eb7b9749f2
commit 511155db51
4 changed files with 50 additions and 2 deletions

View File

@ -22,6 +22,7 @@ struct options {
unsigned long depth;
char *deepen_since;
struct string_list deepen_not;
struct string_list push_options;
unsigned progress : 1,
check_self_contained_and_connected : 1,
cloning : 1,
@ -139,6 +140,9 @@ static int set_option(const char *name, const char *value)
else
return -1;
return 0;
} else if (!strcmp(name, "push-option")) {
string_list_append(&options.push_options, value);
return 0;
#if LIBCURL_VERSION_NUM >= 0x070a08
} else if (!strcmp(name, "family")) {
@ -943,6 +947,9 @@ static int push_git(struct discovery *heads, int nr_spec, char **specs)
argv_array_push(&args, "--quiet");
else if (options.verbosity > 1)
argv_array_push(&args, "--verbose");
for (i = 0; i < options.push_options.nr; i++)
argv_array_pushf(&args, "--push-option=%s",
options.push_options.items[i].string);
argv_array_push(&args, options.progress ? "--progress" : "--no-progress");
for_each_string_list_item(cas_option, &cas_options)
argv_array_push(&args, cas_option->string);
@ -1028,6 +1035,7 @@ int cmd_main(int argc, const char **argv)
options.progress = !!isatty(2);
options.thin = 1;
string_list_init(&options.deepen_not, 1);
string_list_init(&options.push_options, 1);
remote = remote_get(argv[1]);