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.