]> git.ipfire.org Git - thirdparty/git.git/blobdiff - parse-options.c
Merge branch 'rs/parse-options-with-keep-unknown-abbrev-fix'
[thirdparty/git.git] / parse-options.c
index e4fda09af49a5db6406dc35bd0fcfe6f2176737e..63a99dea6ef06b19bbb679a3ddd76087abc2a028 100644 (file)
@@ -2,8 +2,6 @@
 #include "parse-options.h"
 #include "abspath.h"
 #include "parse.h"
-#include "commit.h"
-#include "color.h"
 #include "gettext.h"
 #include "strbuf.h"
 #include "string-list.h"
@@ -279,7 +277,8 @@ static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
 
        opt_name = optnamearg(opt, arg, flags);
        other_opt_name = optnamearg(elem->opt, elem->arg, elem->flags);
-       error(_("%s is incompatible with %s"), opt_name, other_opt_name);
+       error(_("options '%s' and '%s' cannot be used together"),
+             opt_name, other_opt_name);
        free(opt_name);
        free(other_opt_name);
        return -1;
@@ -930,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"))