From: Michael Montalbo Date: Sun, 10 May 2026 02:41:25 GMT Subject: Re: [PATCH 4/4] parse-options: clarify PARSE_OPT_NONEG does not reject negative numbers Message-ID: In-Reply-To: On Sat, May 9, 2026 at 3:01 PM Junio C Hamano wrote: > > "Michael Montalbo via GitGitGadget" writes: > > > From: Michael Montalbo > > > > The name "NONEG" can be misread as "no negative [values]" when it > > actually means "no [boolean] negation" (the --no-* form). > > > > When --inter-hunk-context and -U/--unified were converted from a > > custom parser to OPT_INTEGER_F with PARSE_OPT_NONEG in d473e2e0e8 > > and 16ed6c97cc, the implicit rejection of negative values (via > > isdigit() in the old opt_arg() parser) was silently lost. The > > previous commits in this series fix the resulting bugs. > > I do not think _NONEG has anything to do with the bug. It was > purely to reject --no-unified and --no-inter-hunk-context. > You are right this was a mistaken assumption on my part. > And there was no change to remove PARSE_OPT_NONEG from anywhere and > use OPT_UNSIGNED instead to fix any of the bugs fixed in this > series, ... > Right, PARSE_OPT_NONEG is still enabled implicitly by OPT_UNSIGNED so PARSE_OPT_NONEG really has no part in the story. > > > > Add a clarifying note to the flag documentation. > > > > Signed-off-by: Michael Montalbo > > --- > > parse-options.h | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/parse-options.h b/parse-options.h > > index 706de9729f..c0a3a3dcae 100644 > > --- a/parse-options.h > > +++ b/parse-options.h > > @@ -116,7 +116,10 @@ typedef int parse_opt_subcommand_fn(int argc, const char **argv, > > * mask of parse_opt_option_flags. > > * PARSE_OPT_OPTARG: says that the argument is optional (not for BOOLEANs) > > * PARSE_OPT_NOARG: says that this option does not take an argument > > - * PARSE_OPT_NONEG: says that this option cannot be negated > > + * PARSE_OPT_NONEG: says that this option cannot be negated (i.e. > > + * prevents --no-