summaryrefslogtreecommitdiff
path: root/remote-curl.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-06-12 17:53:59 +0700
committerJunio C Hamano <gitster@pobox.com>2016-06-13 14:38:16 -0700
commit508ea88226bbdd25ac0aac4f9c8a65a2c3b5be5c (patch)
treebcb1da3b374e618f5c6fb6f17c4b3000b0090ada /remote-curl.c
parent569e554be9cb88047d9f2752750e0c260241f446 (diff)
downloadgit-508ea88226bbdd25ac0aac4f9c8a65a2c3b5be5c.tar.gz
fetch: define shallow boundary with --shallow-since
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-curl.c')
-rw-r--r--remote-curl.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/remote-curl.c b/remote-curl.c
index fd030c13c8..5876f24023 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -20,6 +20,7 @@ static struct strbuf url = STRBUF_INIT;
struct options {
int verbosity;
unsigned long depth;
+ char *deepen_since;
unsigned progress : 1,
check_self_contained_and_connected : 1,
cloning : 1,
@@ -60,6 +61,10 @@ static int set_option(const char *name, const char *value)
options.depth = v;
return 0;
}
+ else if (!strcmp(name, "deepen-since")) {
+ options.deepen_since = xstrdup(value);
+ return 0;
+ }
else if (!strcmp(name, "followtags")) {
if (!strcmp(value, "true"))
options.followtags = 1;
@@ -699,8 +704,8 @@ static int fetch_dumb(int nr_heads, struct ref **to_fetch)
char **targets = xmalloc(nr_heads * sizeof(char*));
int ret, i;
- if (options.depth)
- die("dumb http transport does not support --depth");
+ if (options.depth || options.deepen_since)
+ die("dumb http transport does not support shallow capabilities");
for (i = 0; i < nr_heads; i++)
targets[i] = xstrdup(oid_to_hex(&to_fetch[i]->old_oid));
@@ -746,6 +751,8 @@ static int fetch_git(struct discovery *heads,
argv_array_push(&args, "--no-progress");
if (options.depth)
argv_array_pushf(&args, "--depth=%lu", options.depth);
+ if (options.deepen_since)
+ argv_array_pushf(&args, "--shallow-since=%s", options.deepen_since);
argv_array_push(&args, url.buf);
for (i = 0; i < nr_heads; i++) {