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>
This commit is contained in:

committed by
Junio C Hamano

parent
569e554be9
commit
508ea88226
@ -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++) {
|
||||
|
Reference in New Issue
Block a user