From: Eric Sunshine Date: Thu, 17 Mar 2016 08:14:47 GMT Subject: Re: [PATCH/RFC] parse-options.c: make OPTION__COUNTUP consider negative values Message-ID: In-Reply-To: On Thu, Mar 17, 2016 at 3:28 AM, Eric Sunshine wrote: > I also realized that Pranit can achieve the desired behavior without > modifying OPT__VERBOSE at all. Specifically, rather than initializing > his opt_verbose variable to -1, he can instead initialize it to 1. > Then: > > * if --verbose is seen (one or more times), opt_verbose will be >=2, > and the real verbosity level will be (opt_verbose - 1) > > * if --no-verbose is seen, opt_verbose will be 0 > > * if neither is seen, then opt_verbose will remain 1 Eh, this is bogus. "git commit --no-verbose --verbose" would leave opt_verbose at 1, which would fool it into thinking neither had been seen. Thus, a further +1 for an OPT__VERBOSE which understands "unspecified". > However, I think this approach is far too ugly and non-obvious to > seriously suggest using it, whereas the change to OPT__VERBOSE is > easily understood and could prove useful in the future for other > commands with multiple verbosity levels.