summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0f1930c)
raw | patch | inline | side by side (parent: 0f1930c)
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Tue, 28 Feb 2012 19:06:09 +0000 (20:06 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 28 Feb 2012 19:48:11 +0000 (11:48 -0800) |
PARSE_OPT_NEGHELP is confusing because short options defined with that
flag do the opposite of what the helptext says. It is also not needed
anymore now that options starting with no- can be negated by removing
that prefix. Convert its only two users to OPT_NEGBIT() and OPT_BOOL()
and then remove support for PARSE_OPT_NEGHELP.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
flag do the opposite of what the helptext says. It is also not needed
anymore now that options starting with no- can be negated by removing
that prefix. Convert its only two users to OPT_NEGBIT() and OPT_BOOL()
and then remove support for PARSE_OPT_NEGHELP.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fast-export.c | patch | blob | history | |
builtin/grep.c | patch | blob | history | |
parse-options.c | patch | blob | history | |
parse-options.h | patch | blob | history |
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 9836e6b7ca22e254c06d8d766d510ef43a8cbe90..61653466a6e40581a1d755ca1dec97fde0456c2b 100644 (file)
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
"Output full tree for each commit"),
OPT_BOOLEAN(0, "use-done-feature", &use_done_feature,
"Use the done feature to terminate the stream"),
- { OPTION_NEGBIT, 0, "data", &no_data, NULL,
- "Skip output of blob data",
- PARSE_OPT_NOARG | PARSE_OPT_NEGHELP, NULL, 1 },
+ OPT_BOOL(0, "no-data", &no_data, "Skip output of blob data"),
OPT_END()
};
diff --git a/builtin/grep.c b/builtin/grep.c
index a286692e467710d92346ab6900e98f1126cb967d..461d1c24659d6d3f2695c3cbfde0530a351e87a7 100644 (file)
--- a/builtin/grep.c
+++ b/builtin/grep.c
struct option options[] = {
OPT_BOOLEAN(0, "cached", &cached,
"search in index instead of in the work tree"),
- OPT_BOOLEAN(0, "index", &use_index,
- "--no-index finds in contents not managed by git"),
+ OPT_NEGBIT(0, "no-index", &use_index,
+ "finds in contents not managed by git", 1),
OPT_GROUP(""),
OPT_BOOLEAN('v', "invert-match", &opt.invert,
"show non-matching lines"),
diff --git a/parse-options.c b/parse-options.c
index 890684166520659106703420fe80be147c7ad75d..190899611ef9f53a0bc5dc7b1a7f419350a301be 100644 (file)
--- a/parse-options.c
+++ b/parse-options.c
continue;
pos = fprintf(outfile, " ");
- if (opts->short_name && !(opts->flags & PARSE_OPT_NEGHELP)) {
+ if (opts->short_name) {
if (opts->flags & PARSE_OPT_NODASH)
pos += fprintf(outfile, "%c", opts->short_name);
else
if (opts->long_name && opts->short_name)
pos += fprintf(outfile, ", ");
if (opts->long_name)
- pos += fprintf(outfile, "--%s%s",
- (opts->flags & PARSE_OPT_NEGHELP) ? "no-" : "",
- opts->long_name);
+ pos += fprintf(outfile, "--%s", opts->long_name);
if (opts->type == OPTION_NUMBER)
pos += fprintf(outfile, "-NUM");
diff --git a/parse-options.h b/parse-options.h
index 2e811dc7da8e6adc7ebce1a9929e8c345424fe4a..def9ced739b675cbcdac7598c3baebf5423239a0 100644 (file)
--- a/parse-options.h
+++ b/parse-options.h
PARSE_OPT_LASTARG_DEFAULT = 16,
PARSE_OPT_NODASH = 32,
PARSE_OPT_LITERAL_ARGHELP = 64,
- PARSE_OPT_NEGHELP = 128,
PARSE_OPT_SHELL_EVAL = 256
};
* PARSE_OPT_LITERAL_ARGHELP: says that argh shouldn't be enclosed in brackets
* (i.e. '<argh>') in the help message.
* Useful for options with multiple parameters.
- * PARSE_OPT_NEGHELP: says that the long option should always be shown with
- * the --no prefix in the usage message. Sometimes
- * useful for users of OPTION_NEGBIT.
*
* `callback`::
* pointer to the callback to use for OPTION_CALLBACK or