aboutsummaryrefslogtreecommitdiffstats
path: root/parse-options.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-08-17 13:09:56 -0700
committerJunio C Hamano <gitster@pobox.com>2018-08-17 13:09:56 -0700
commit8963bb0c2d023738f8ea021b512ed83cd79ee754 (patch)
treefbf8f5e69b46d4a01a9b26c0b2434c4be3de5d4d /parse-options.c
parent28dbabb5e04d0d2bc714c46f24dfbf102089c15b (diff)
parent5f0df44cd79a953c287ccb598896ea7aaa2cc9e3 (diff)
downloadgit-8963bb0c2d023738f8ea021b512ed83cd79ee754.tar.gz
Merge branch 'rs/parse-opt-lithelp'
The parse-options machinery learned to refrain from enclosing placeholder string inside a "<bra" and "ket>" pair automatically without PARSE_OPT_LITERAL_ARGHELP. Existing help text for option arguments that are not formatted correctly have been identified and fixed. * rs/parse-opt-lithelp: parse-options: automatically infer PARSE_OPT_LITERAL_ARGHELP shortlog: correct option help for -w send-pack: specify --force-with-lease argument help explicitly pack-objects: specify --index-version argument help explicitly difftool: remove angular brackets from argument help add, update-index: fix --chmod argument help push: use PARSE_OPT_LITERAL_ARGHELP instead of unbalanced brackets
Diffstat (limited to 'parse-options.c')
-rw-r--r--parse-options.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/parse-options.c b/parse-options.c
index 7db84227ab..3b874a83a0 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -660,7 +660,8 @@ int parse_options(int argc, const char **argv, const char *prefix,
static int usage_argh(const struct option *opts, FILE *outfile)
{
const char *s;
- int literal = (opts->flags & PARSE_OPT_LITERAL_ARGHELP) || !opts->argh;
+ int literal = (opts->flags & PARSE_OPT_LITERAL_ARGHELP) ||
+ !opts->argh || !!strpbrk(opts->argh, "()<>[]|");
if (opts->flags & PARSE_OPT_OPTARG)
if (opts->long_name)
s = literal ? "[=%s]" : "[=<%s>]";