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
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 19, 2017, 07:02 UTC
Message-ID
<CACBZZX5wHvWgqjBaiD4pJsVQug=+-4xRwkvfZ0uZ=meE3xR6NQ@mail.gmail.com>
In-Reply-To
<20170419025016.we3tfuvgppuamc7g@sigill.intra.peff.net>
On Wed, Apr 19, 2017 at 4:50 AM, Jeff King <peff@peff.net> wrote:
Show 18 quoted lines
> On Tue, Apr 18, 2017 at 07:40:37PM -0700, Junio C Hamano wrote:
>
>> > It might even be possible to detect the existing line and
>> > have parse-options automatically respect "--foo" when "--no-foo" is
>> > present.  But that may run afoul of callers that add both "--foo" and
>> > "--no-foo" manually.
>>
>> True but wouldn't that something we would want to avoid anyway?
>> That is, "git cmd [--OPT | --no-OPT | --no-no-OPT]" from the end
>> user's point of view should be an error because it is unclear what
>> difference there are between --OPT and --no-no-OPT.  And we should
>> be able to add a rule to parse_options_check() to catch such an
>> error.
>
> I meant that if you have something like this in your options array:
>
>   { 0, "foo", OPTION_INTEGER, &foo, 1 },
>   { 0, "no-foo", OPTION_INTEGER, &foo, 2 },

I may be missing something, but don't we already do exactly what you're describing here? See commit f1930c587 ("parse-options: allow positivation of options starting, with no-", 2012-02-25) from René Scharfe.

Previous: Jeff KingNext: Jacob Keller
Message 6 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.