On Wed, Apr 19, 2017 at 4:50 AM, Jeff King <peff@xxxxxxxx> 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.