Michael Haggerty <mhag...@alum.mit.edu> writes:

> This tightens up the parsing a bit:
>
> * Leading whitespace is no longer allowed
> * '+' and '-' are no longer allowed
>
> It also removes the need to check separately that max_count is
> non-negative.

Hmmm, on the surface this sound nice, but I am not sure if it is a
good idea.  "git cmd-in-log-family -3 --max-count=-1" would have
been a nice way to flip a max-count given earlier on the command
line back to the default (unlimited) and we are removing it without
giving any escape hatch?

>
> Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu>
> ---
>  revision.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/revision.c b/revision.c
> index 25838fc..4908e66 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -1,4 +1,5 @@
>  #include "cache.h"
> +#include "numparse.h"
>  #include "tag.h"
>  #include "blob.h"
>  #include "tree.h"
> @@ -1709,8 +1710,7 @@ 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" */
> -             if (strtol_i(arg + 1, 10, &revs->max_count) < 0 ||
> -                 revs->max_count < 0)
> +             if (convert_i(arg + 1, 10, &revs->max_count))
>                       die("'%s': not a non-negative integer", arg + 1);

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to