Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'jc/revision-dash-count-parsing' into maint
author
Junio C Hamano
<gitster@pobox.com>
Wed, 25 Jun 2014 18:44:53 +0000
(11:44 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 25 Jun 2014 18:44:53 +0000
(11:44 -0700)
"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
revision.c
patch
|
blob
|
history
raw
(from parent 1:
81bd9b1
)
diff --git
a/revision.c
b/revision.c
index 71e233742331a435edeadacc7c6a52226bb18b7a..f6a10883813ca72fd7df0e827aeab58aa6cf786e 100644
(file)
--- 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)