Thread (8 messages) flat view 8 messages, 3 authors, 2016-06-15

Re: [PATCH/RFC] parse-options.c: make OPTION__COUNTUP consider negative values

From: Eric Sunshine <hidden>
Date: 2016-06-15 23:08:47

On Thu, Mar 17, 2016 at 3:28 AM, Eric Sunshine [off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help