Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-06-25 22:44:53 +0400
committerJunio C Hamano <gitster@pobox.com>2014-06-25 22:44:53 +0400
commit91043fc95c20e03b1827b86498b7966349dd9ffe (patch)
tree9321ac43d66e62aa644e97e5dd418fe17e232023 /revision.c
parent81bd9b100064094bf6db05d85853284e9b15376a (diff)
parente3fa568cb397a78a56716137c826f21f5e0b0a77 (diff)
Merge branch 'jc/revision-dash-count-parsing' into maint
"git log -2master" is a common typo that shows two commits starting from whichever random branch that is not 'master' that happens to be checked out currently. * jc/revision-dash-count-parsing: revision: parse "git log -<count>" more carefully
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/revision.c b/revision.c
index 71e2337423..f6a1088381 100644
--- a/revision.c
+++ b/revision.c
@@ -1648,8 +1648,10 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
revs->skip_count = atoi(optarg);
return argcount;
} else if ((*arg == '-') && isdigit(arg[1])) {
- /* accept -<digit>, like traditional "head" */
- revs->max_count = atoi(arg + 1);
+ /* accept -<digit>, like traditional "head" */
+ if (strtol_i(arg + 1, 10, &revs->max_count) < 0 ||
+ revs->max_count < 0)
+ die("'%s': not a non-negative integer", arg + 1);
revs->no_walk = 0;
} else if (!strcmp(arg, "-n")) {
if (argc <= 1)