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

Re: [PATCH] various: disallow --no-no-OPT for --no-opt options

From
René Scharfe <l.s.r@web.de>
Date
Apr 19, 2017, 13:11 UTC
Message-ID
<b4eef4c1-cd5a-aa71-fc79-8af89dbe365d@web.de>
In-Reply-To
<CACBZZX6XWXjvDKeR+a1Ymb4csXgOKLiF==VkKLp5S9TRVQhgoA@mail.gmail.com>
Am 19.04.2017 um 09:00 schrieb Ævar Arnfjörð Bjarmason:
Show 15 quoted lines
> On Wed, Apr 19, 2017 at 12:29 AM, René Scharfe <l.s.r@web.de> wrote:
>> Setting PARSE_OPT_NONEG takes away the ability to toggle the affected
>> option.  E.g. git clone would reject --checkout.  Currently users can
>> specify --no- options as defaults in aliases and override them on the
>> command line if needed, with the patch that won't be possible anymore.
>>
>> PARSE_OPT_NONEG should only be used for options where a negation doesn't
>> make sense, e.g. for the --stage option of checkout-index.
> 
> That's a bad bug, I don't know whether to be surprised or not that we
> had no tests for this :)
> 
> I thought I was just disabling --no-no-checkout for --no-checkout, not
> --checkout, but didn't notice the subtleties of the special case
> handling for --no-* in parse-options.c, thanks.
I'm confused.  What's the bug here?

--no-no-checkout is undocumented; Jacob's patch addresses it. --no-checkout is the documented form. Negation allows --checkout to be used as well, with the opposite meaning to --no-checkout. Turning off negation with PARSE_OPT_NONEG forbids --checkout to be used.

Perhaps the issue is that a single line of documentation is not enough ("PARSE_OPT_NONEG: says that this option cannot be negated")?

René
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 10 of 12 in “various: disallow --no-no-OPT for --no-opt options”
  1. various: disallow --no-no-OPT for --no-opt optionsÆvar Arnfjörð Bjarmason, Apr 18, 2017
  2. René ScharfeApr 18, 2017
  3. Jeff KingApr 19, 2017
  4. Junio C HamanoApr 19, 2017
  5. Jeff KingApr 19, 2017
  6. Ævar Arnfjörð BjarmasonApr 19, 2017
  7. Jacob KellerApr 19, 2017
  8. Jeff KingApr 19, 2017
  9. Ævar Arnfjörð BjarmasonApr 19, 2017
  10. René ScharfeApr 19, 2017
  11. Ævar Arnfjörð BjarmasonApr 19, 2017
  12. René ScharfeApr 19, 2017

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.