diff options
Diffstat (limited to 'pretty.c')
-rw-r--r-- | pretty.c | 31 |
1 files changed, 23 insertions, 8 deletions
@@ -1279,28 +1279,43 @@ int format_set_trailers_options(struct process_trailer_options *opts, static size_t parse_describe_args(const char *start, struct strvec *args) { - const char *options[] = { "match", "exclude" }; + const char *options[] = { "tags" }; + const char *option_arguments[] = { "match", "exclude", "abbrev" }; const char *arg = start; for (;;) { const char *matched = NULL; - const char *argval; + const char *argval = NULL; size_t arglen = 0; + int optval = 0; int i; - for (i = 0; i < ARRAY_SIZE(options); i++) { - if (match_placeholder_arg_value(arg, options[i], &arg, + for (i = 0; i < ARRAY_SIZE(option_arguments); i++) { + if (match_placeholder_arg_value(arg, option_arguments[i], &arg, &argval, &arglen)) { - matched = options[i]; + matched = option_arguments[i]; + if (!arglen) + return 0; break; } } if (!matched) + for (i = 0; i < ARRAY_SIZE(options); i++) { + if (match_placeholder_bool_arg(arg, options[i], &arg, + &optval)) { + matched = options[i]; + break; + } + } + if (!matched) break; - if (!arglen) - return 0; - strvec_pushf(args, "--%s=%.*s", matched, (int)arglen, argval); + + if (argval) { + strvec_pushf(args, "--%s=%.*s", matched, (int)arglen, argval); + } else if (optval) { + strvec_pushf(args, "--%s", matched); + } } return arg - start; } |