Skip to content

Commit

Permalink
Catch invalid --depth option passed to clone or fetch
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Jan 4, 2012
1 parent 15b7898 commit e7622ce
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions transport.c
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit e7622ce

Please sign in to comment.