summaryrefslogtreecommitdiff
path: root/parse-options.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2009-09-25 18:44:44 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2009-09-29 14:28:47 (GMT)
commit6bbfd1fa98b0c1fa1684bd35e64404799f0cc2b3 (patch)
tree71bb1a417abd88c93872ae14ac4c93741e254152 /parse-options.c
parent5bdc32d3e50d8335c65e136e6b5234c5dd92a7a9 (diff)
downloadgit-6bbfd1fa98b0c1fa1684bd35e64404799f0cc2b3.zip
git-6bbfd1fa98b0c1fa1684bd35e64404799f0cc2b3.tar.gz
git-6bbfd1fa98b0c1fa1684bd35e64404799f0cc2b3.tar.bz2
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 <schwab@linux-m68k.org> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'parse-options.c')
-rw-r--r--parse-options.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/parse-options.c b/parse-options.c
index a64a4d6..f559411 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;