diff --git a/diff.c b/diff.c index a74bfb4a60..832af35c91 100644 --- a/diff.c +++ b/diff.c @@ -5680,15 +5680,19 @@ static void prep_parse_options(struct diff_options *options) int diff_opt_parse(struct diff_options *options, const char **av, int ac, const char *prefix) { + struct option no_options[] = { OPT_END() }; + struct option *parseopts = add_diff_options(no_options, options); + if (!prefix) prefix = ""; - ac = parse_options(ac, av, prefix, options->parseopts, NULL, + ac = parse_options(ac, av, prefix, parseopts, NULL, PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_UNKNOWN_OPT | PARSE_OPT_NO_INTERNAL_HELP | PARSE_OPT_ONE_SHOT | PARSE_OPT_STOP_AT_NON_OPTION); + free(parseopts); return ac; }