]> git.ipfire.org Git - thirdparty/git.git/blobdiff - parse-options.c
Merge branch 'jk/end-of-options' into jc/sparse-checkout-set-add-end-of-options
[thirdparty/git.git] / parse-options.c
index e0c94b0546b5487c5b324c4c2b76d668289e8b10..d50962062ead7dfb4d831199a5dca2e0b4316227 100644 (file)
@@ -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"))