diff: factor out add_diff_options()

Add a function for appending the parseopts member of struct diff_options
to a struct option array.  Use it in two sites instead of accessing the
parseopts member directly.  Decoupling callers from diff internals like
that allows us to change the latter.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2022-12-01 23:49:11 +01:00
committed by Junio C Hamano
parent e7e5c6f715
commit c5630c4868
4 changed files with 9 additions and 3 deletions

View File

@@ -255,8 +255,7 @@ int diff_no_index(struct rev_info *revs,
};
struct option *options;
options = parse_options_concat(no_index_options,
revs->diffopt.parseopts);
options = add_diff_options(no_index_options, &revs->diffopt);
argc = parse_options(argc, argv, revs->prefix, options,
diff_no_index_usage, 0);
if (argc != 2) {