author | Andreas Schwab <schwab@linux-m68k.org> | |
Fri, 25 Sep 2009 18:44:44 +0000 (20:44 +0200) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 29 Sep 2009 14:28:47 +0000 (07:28 -0700) | ||
commit | 6bbfd1fa98b0c1fa1684bd35e64404799f0cc2b3 | |
tree | 71bb1a417abd88c93872ae14ac4c93741e254152 | tree | snapshot |
parent | 5bdc32d3e50d8335c65e136e6b5234c5dd92a7a9 | commit | diff |
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>
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>
parse-options.c | diff | blob | history | |
t/t0040-parse-options.sh | diff | blob | history | |
test-parse-options.c | diff | blob | history |