git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 17, 2016, 08:14 UTC
Message-ID
<CAPig+cTi7biYK7=P07-VZvA=d6mwgsdYxZG_vvVm7sRj2fcu6Q@mail.gmail.com>
In-Reply-To
<CAPig+cRkAE4BzbgniP=peHE-pBfKt1i2C4MqJcJ36sMfsSh3KQ@mail.gmail.com>
On Thu, Mar 17, 2016 at 3:28 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 11 quoted lines
> 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.
Previous: Eric SunshineNext: Pranit Bauva
Message 4 of 8 in “parse-options.c: make OPTION__COUNTUP consider negative values”
  1. parse-options.c: make OPTION__COUNTUP consider negative valuesPranit Bauva, Mar 16, 2016
  2. Jeff KingMar 17, 2016
  3. Eric SunshineMar 17, 2016
  4. Eric SunshineMar 17, 2016
  5. Pranit BauvaMar 17, 2016
  6. Pranit BauvaMar 18, 2016
  7. Jeff KingMar 20, 2016
  8. Pranit BauvaMar 20, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.