diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2022-08-19 18:03:57 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-08-19 20:13:14 +0200 |
commit | 99d86d60e59e11cbc46766346e3e379164a6e4df (patch) | |
tree | 01d48b5ff8a6815654379ac8f3ddf939e6b8b9f9 /parse-options.c | |
parent | api-parse-options.txt: fix description of OPT_CMDMODE (diff) | |
download | git-99d86d60e59e11cbc46766346e3e379164a6e4df.tar.xz git-99d86d60e59e11cbc46766346e3e379164a6e4df.zip |
parse-options: PARSE_OPT_KEEP_UNKNOWN only applies to --options
The description of 'PARSE_OPT_KEEP_UNKNOWN' starts with "Keep unknown
arguments instead of erroring out". This is a bit misleading, as this
flag only applies to unknown --options, while non-option arguments are
kept even without this flag.
Update the description to clarify this, and rename the flag to
PARSE_OPTIONS_KEEP_UNKNOWN_OPT to make this obvious just by looking at
the flag name.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.c')
-rw-r--r-- | parse-options.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/parse-options.c b/parse-options.c index edf55d3ef5..a0a2cf98fa 100644 --- a/parse-options.c +++ b/parse-options.c @@ -332,7 +332,7 @@ again: rest = NULL; if (!rest) { /* abbreviated? */ - if (!(p->flags & PARSE_OPT_KEEP_UNKNOWN) && + if (!(p->flags & PARSE_OPT_KEEP_UNKNOWN_OPT) && !strncmp(long_name, arg, arg_end - arg)) { is_abbreviated: if (abbrev_option && @@ -515,7 +515,7 @@ static void parse_options_start_1(struct parse_opt_ctx_t *ctx, ctx->prefix = prefix; ctx->cpidx = ((flags & PARSE_OPT_KEEP_ARGV0) != 0); ctx->flags = flags; - if ((flags & PARSE_OPT_KEEP_UNKNOWN) && + if ((flags & PARSE_OPT_KEEP_UNKNOWN_OPT) && (flags & PARSE_OPT_STOP_AT_NON_OPTION) && !(flags & PARSE_OPT_ONE_SHOT)) BUG("STOP_AT_NON_OPTION and KEEP_UNKNOWN don't go together"); @@ -839,7 +839,7 @@ enum parse_opt_result parse_options_step(struct parse_opt_ctx_t *ctx, unknown: if (ctx->flags & PARSE_OPT_ONE_SHOT) break; - if (!(ctx->flags & PARSE_OPT_KEEP_UNKNOWN)) + if (!(ctx->flags & PARSE_OPT_KEEP_UNKNOWN_OPT)) return PARSE_OPT_UNKNOWN; ctx->out[ctx->cpidx++] = ctx->argv[0]; ctx->opt = NULL; |