Subject: Re: [PATCH 1/4] t/helper: improve "genrandom" test helper

From: Jeff King <[email-masked]>
Date: Mon, 23 Feb 2026 06:13:46 -0500

On Mon, Feb 23, 2026 at 10:50:40AM +0100, Patrick Steinhardt wrote:

> Fix both of these issues by using `git_parse_ulong()` to parse the
> argumemnt. This function has better error handling, and it knows to
> handle unit suffixes.

Makes sense, but...

> @@ -22,7 +23,9 @@ int cmd__genrandom(int argc, const char **argv)
>  		next = next * 11 + *c;
>  	} while (*c++);
>  
> -	count = (argc == 3) ? strtoul(argv[2], NULL, 0) : ULONG_MAX;
> +	count = ULONG_MAX;
> +	if (argc == 3 && git_parse_ulong(argv[2], &count) < 0)
> +		return error_errno("cannot parse argument '%s'", argv[2]);

...I think the return value of git_parse_ulong() is boolean 0/1, not
0/negative.

-Peff