aboutsummaryrefslogtreecommitdiffstats
path: root/parse-options.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-12-20 21:49:33 -0800
committerJunio C Hamano <gitster@pobox.com>2023-12-20 21:49:33 -0800
commit2e13ed4671d12ff996b1b44cf5a33de4d2c54b55 (patch)
treec13d4bfb569f7714c60f07280aa26c26b7b17b48 /parse-options.c
parentGit 2.43 (diff)
parentparse-options: decouple "--end-of-options" and "--" (diff)
downloadgit-2e13ed4671d12ff996b1b44cf5a33de4d2c54b55.tar.gz
git-2e13ed4671d12ff996b1b44cf5a33de4d2c54b55.zip
Merge branch 'jk/end-of-options' into jc/sparse-checkout-set-add-end-of-options
* jk/end-of-options: parse-options: decouple "--end-of-options" and "--"
Diffstat (limited to 'parse-options.c')
-rw-r--r--parse-options.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/parse-options.c b/parse-options.c
index e0c94b0546..d50962062e 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -929,13 +929,18 @@ enum parse_opt_result parse_options_step(struct parse_opt_ctx_t *ctx,
continue;
}
- if (!arg[2] /* "--" */ ||
- !strcmp(arg + 2, "end-of-options")) {
+ if (!arg[2] /* "--" */) {
if (!(ctx->flags & PARSE_OPT_KEEP_DASHDASH)) {
ctx->argc--;
ctx->argv++;
}
break;
+ } else if (!strcmp(arg + 2, "end-of-options")) {
+ if (!(ctx->flags & PARSE_OPT_KEEP_UNKNOWN_OPT)) {
+ ctx->argc--;
+ ctx->argv++;
+ }
+ break;
}
if (internal_help && !strcmp(arg + 2, "help-all"))