summaryrefslogtreecommitdiff
path: root/parse-options.c
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2022-08-19 16:03:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-08-19 18:13:14 (GMT)
commit99d86d60e59e11cbc46766346e3e379164a6e4df (patch)
tree01d48b5ff8a6815654379ac8f3ddf939e6b8b9f9 /parse-options.c
parent80882bc5e7143a0c3823b5a398fd76c9138437ef (diff)
downloadgit-99d86d60e59e11cbc46766346e3e379164a6e4df.zip
git-99d86d60e59e11cbc46766346e3e379164a6e4df.tar.gz
git-99d86d60e59e11cbc46766346e3e379164a6e4df.tar.bz2
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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/parse-options.c b/parse-options.c
index edf55d3..a0a2cf9 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;