Merge branch 'jc/revision-dash-count-parsing'

"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
This commit is contained in:
Junio C Hamano 2014-06-20 13:10:25 -07:00
Родитель cb682f8cfe e3fa568cb3
Коммит 7a3b4e3bd2
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -1650,7 +1650,9 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
return argcount;
} else if ((*arg == '-') && isdigit(arg[1])) {
/* accept -<digit>, like traditional "head" */
revs->max_count = atoi(arg + 1);
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)