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
Jeff King <peff@peff.net>
Date
Apr 19, 2017, 15:05 UTC
Message-ID
<20170419150556.ycydwyoi27j7veva@sigill.intra.peff.net>
In-Reply-To
<CACBZZX5wHvWgqjBaiD4pJsVQug=+-4xRwkvfZ0uZ=meE3xR6NQ@mail.gmail.com>
On Wed, Apr 19, 2017 at 09:02:52AM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 24 quoted lines
> On Wed, Apr 19, 2017 at 4:50 AM, Jeff King <peff@peff.net> wrote:
> > 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.
Oh, so we do. I somehow totally missed that.

I think all is well, then. We do accept --no-no-foo still. IMHO it is not that big a deal (as long as we do not advertise it, then it does not hurt unless somebody actually tries it). But I do not mind if it goes away, as long as the positive --foo form still works (and it sounds from Jake's response that we'd need to do more than just NONEG there).

-Peff
Previous: Jacob KellerNext: Ævar Arnfjörð Bjarmason
Message 8 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.