From 6bbfd1fa98b0c1fa1684bd35e64404799f0cc2b3 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 25 Sep 2009 20:44:44 +0200 Subject: parse-opt: ignore negation of OPT_NONEG for ambiguity checks parse_long_opt always matches both --opt and --no-opt for any option "opt", and only get_value checks whether --no-opt is actually valid. Since the options for git branch contains both "no-merged" and "merged" there are two matches for --no-merge, but no exact match. With this patch the negation of a NONEG option is rejected earlier, but it changes the error message from "option `no-opt' isn't available" to "unknown option `no-opt'". [jk: added test] Signed-off-by: Andreas Schwab Signed-off-by: Jeff King Signed-off-by: Shawn O. Pearce --- parse-options.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'parse-options.c') diff --git a/parse-options.c b/parse-options.c index a64a4d6ee2..f5594114ed 100644 --- a/parse-options.c +++ b/parse-options.c @@ -230,6 +230,9 @@ is_abbreviated: abbrev_flags = flags; continue; } + /* negation allowed? */ + if (options->flags & PARSE_OPT_NONEG) + continue; /* negated and abbreviated very much? */ if (!prefixcmp("no-", arg)) { flags |= OPT_UNSET; -- cgit v1.2.1