From: Nguyễn Thái Ngọc Duy Date: Wed, 4 Jan 2012 10:01:55 +0000 (+0700) Subject: Catch invalid --depth option passed to clone or fetch X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=e7622ce8c4c3d5c0a596ace7fb34afe0d1e273ef;p=~andy%2Fgit Catch invalid --depth option passed to clone or fetch Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff --git a/transport.c b/transport.c index c9c8056f9..7bfbf31f6 100644 --- a/transport.c +++ b/transport.c @@ -472,8 +472,12 @@ static int set_git_option(struct git_transport_options *opts, } else if (!strcmp(name, TRANS_OPT_DEPTH)) { if (!value) opts->depth = 0; - else - opts->depth = atoi(value); + else { + char *end; + opts->depth = strtol(value, &end, 0); + if (*end) + die("transport: invalid depth option '%s'", value); + } return 0; } return 1;