parse-options: disable option abbreviation with PARSE_OPT_KEEP_UNKNOWN
[gitweb.git] / parse-options.c
index 740ae5438f93d65d660cfec51edc56c8df145e2b..779034e1fd86ad7cbd987d859656abd4c3f782d6 100644 (file)
@@ -266,7 +266,8 @@ static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg,
                }
                if (!rest) {
                        /* abbreviated? */
-                       if (!strncmp(long_name, arg, arg_end - arg)) {
+                       if (!(p->flags & PARSE_OPT_KEEP_UNKNOWN) &&
+                           !strncmp(long_name, arg, arg_end - arg)) {
 is_abbreviated:
                                if (abbrev_option) {
                                        /*