Thread (7 messages) 7 messages, 3 authors, 2017-04-19

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

From: René Scharfe <hidden>
Date: 2017-04-19 13:11:38

Am 19.04.2017 um 09:00 schrieb Ævar Arnfjörð Bjarmason:
On Wed, Apr 19, 2017 at 12:29 AM, René Scharfe [off-list ref] wrote:
quoted
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é
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help