summaryrefslogtreecommitdiff
path: root/remote-curl.c
diff options
context:
space:
mode:
Diffstat (limited to 'remote-curl.c')
-rw-r--r--remote-curl.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/remote-curl.c b/remote-curl.c
index 0053b09549..a7c4c9b5ff 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -13,6 +13,7 @@
#include "credential.h"
#include "sha1-array.h"
#include "send-pack.h"
+#include "quote.h"
static struct remote *remote;
/* always ends with a trailing slash */
@@ -24,6 +25,7 @@ struct options {
char *deepen_since;
struct string_list deepen_not;
struct string_list push_options;
+ char *filter;
unsigned progress : 1,
check_self_contained_and_connected : 1,
cloning : 1,
@@ -33,7 +35,9 @@ struct options {
thin : 1,
/* One of the SEND_PACK_PUSH_CERT_* constants. */
push_cert : 2,
- deepen_relative : 1;
+ deepen_relative : 1,
+ from_promisor : 1,
+ no_dependents : 1;
};
static struct options options;
static struct string_list cas_options = STRING_LIST_INIT_DUP;
@@ -142,7 +146,15 @@ static int set_option(const char *name, const char *value)
return -1;
return 0;
} else if (!strcmp(name, "push-option")) {
- string_list_append(&options.push_options, value);
+ if (*value != '"')
+ string_list_append(&options.push_options, value);
+ else {
+ struct strbuf unquoted = STRBUF_INIT;
+ if (unquote_c_style(&unquoted, value, NULL) < 0)
+ die("invalid quoting in push-option value");
+ string_list_append_nodup(&options.push_options,
+ strbuf_detach(&unquoted, NULL));
+ }
return 0;
#if LIBCURL_VERSION_NUM >= 0x070a08
@@ -157,6 +169,15 @@ static int set_option(const char *name, const char *value)
return -1;
return 0;
#endif /* LIBCURL_VERSION_NUM >= 0x070a08 */
+ } else if (!strcmp(name, "from-promisor")) {
+ options.from_promisor = 1;
+ return 0;
+ } else if (!strcmp(name, "no-dependents")) {
+ options.no_dependents = 1;
+ return 0;
+ } else if (!strcmp(name, "filter")) {
+ options.filter = xstrdup(value);;
+ return 0;
} else {
return 1 /* unsupported */;
}
@@ -339,6 +360,8 @@ static struct discovery *discover_refs(const char *service, int for_push)
* pkt-line matches our request.
*/
line = packet_read_line_buf(&last->buf, &last->len, NULL);
+ if (!line)
+ die("invalid server response; expected service, got flush packet");
strbuf_reset(&exp);
strbuf_addf(&exp, "# service=%s", service);
@@ -822,6 +845,12 @@ static int fetch_git(struct discovery *heads,
options.deepen_not.items[i].string);
if (options.deepen_relative && options.depth)
argv_array_push(&args, "--deepen-relative");
+ if (options.from_promisor)
+ argv_array_push(&args, "--from-promisor");
+ if (options.no_dependents)
+ argv_array_push(&args, "--no-dependents");
+ if (options.filter)
+ argv_array_pushf(&args, "--filter=%s", options.filter);
argv_array_push(&args, url.buf);
for (i = 0; i < nr_heads; i++) {