Catch invalid --depth option passed to clone or fetch
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:
parent
15b7898c5e
commit
e7622ce8c4
@ -472,8 +472,12 @@ static int set_git_option(struct git_transport_options *opts,
|
|||||||
} else if (!strcmp(name, TRANS_OPT_DEPTH)) {
|
} else if (!strcmp(name, TRANS_OPT_DEPTH)) {
|
||||||
if (!value)
|
if (!value)
|
||||||
opts->depth = 0;
|
opts->depth = 0;
|
||||||
else
|
else {
|
||||||
opts->depth = atoi(value);
|
char *end;
|
||||||
|
opts->depth = strtol(value, &end, 0);
|
||||||
|
if (*end)
|
||||||
|
die("transport: invalid depth option '%s'", value);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user