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

Re: [PATCH 2/3] parse-options: allow positivation of options starting, with no-

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 26, 2012, 23:32 UTC
Message-ID
<7vy5rpcgrk.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4F49332E.7070003@lsrfire.ath.cx>
René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
Show 6 quoted lines
> Long options can be negated by adding no- right after the leading
> two dashes. This is useful e.g. to override options set by aliases.
>
> For options that are defined to start with no- already, this looks
> a bit funny. Allow such options to also be negated by removing the
> prefix.

True about "a bit funny", but the fact that the solution has to touch parse-options.c confuses me.

I would naïvely expect that it would be sufficient to update an existing definition for "--no-frotz" that uses PARSE_OPT_NONEG to instead define "--frotz" that by itself is a no-op, and "--no-frotz" would cause whatever the option currently means, with an update to the help text that says something to the effect that "--frotz by itself is meaningless and is always used as --no-frotz".

There must be a reason the patch had to take an approach in the opposite direction to allow removal of --[no-] prefix, but it is not obvious to me what it is.

Note that I am _not_ saying that this is a bad change. I am just saying that it is unclear why we still want two different ways to support the "--no-frotz" option, one by defining "frotz" option that allows "no" to be prefixed, and the other by defining "no-frotz" that allows "no-" to be stripped.

Previous: René ScharfeNext: Thomas Rast
Message 4 of 19 in “parse-options: no- symmetry”
  1. 0/3 parse-options: no- symmetryRené Scharfe, Feb 25, 2012
  2. 1/3 test-parse-options: convert to OPT_BOOL()René Scharfe, Feb 25, 2012
  3. 2/3 parse-options: allow positivation of options starting, with no-René Scharfe, Feb 25, 2012
  4. Junio C HamanoFeb 26, 2012
  5. Thomas RastFeb 27, 2012
  6. Junio C HamanoFeb 27, 2012
  7. René ScharfeFeb 27, 2012
  8. Junio C HamanoFeb 27, 2012
  9. 4/3 parse-options: disallow --no-no-sthRené Scharfe, Feb 28, 2012
  10. Junio C HamanoFeb 28, 2012
  11. René ScharfeFeb 29, 2012
  12. Junio C HamanoFeb 29, 2012
  13. 3/3 parse-options: remove PARSE_OPT_NEGHELPRené Scharfe, Feb 25, 2012
  14. Jeff KingFeb 27, 2012
  15. Junio C HamanoFeb 27, 2012
  16. René ScharfeFeb 27, 2012
  17. Jeff KingFeb 28, 2012
  18. 3/3 parse-options: remove PARSE_OPT_NEGHELPRené Scharfe, Feb 28, 2012
  19. Jeff KingFeb 28, 2012

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.