]> git.ipfire.org Git - thirdparty/git.git/blobdiff - parse-options.c
Merge branch 'jk/end-of-options'
[thirdparty/git.git] / parse-options.c
index c3955847f4c9dfb29da07784bc55836da047d5b2..65fab5bb9dca071fac111705f6cbfc439eeef447 100644 (file)
@@ -930,13 +930,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"))