cocci: apply the "diff.h" part of "the_repository.pending"

Apply the part of "the_repository.pending.cocci" pertaining to "diff.h". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Mar 28, 2023 at 15:58 UTC 085390328f5fe1dfba67039b1fd6cc51546a4e41
8 files changed +9 -12
builtin/log.c
+1 -1
@@ -1371,7 +1371,7 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,
1371 .other_arg = &other_arg
1372 };
1373
1374 - diff_setup(&opts);
1374 + repo_diff_setup(the_repository, &opts);
1375 opts.file = rev->diffopt.file;
1376 opts.use_color = rev->diffopt.use_color;
1377 diff_setup_done(&opts);
builtin/rebase.c
+1 -1
@@ -1786,7 +1786,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1786 }
1787
1788 /* We want color (if set), but no pager */
1789 - diff_setup(&opts);
1789 + repo_diff_setup(the_repository, &opts);
1790 opts.stat_width = -1; /* use full terminal width */
1791 opts.stat_graph_width = -1; /* respect statGraphWidth config */
1792 opts.output_format |=
builtin/stash.c
+1 -1
@@ -427,7 +427,7 @@ static void unstage_changes_unless_new(struct object_id *orig_tree)
427 * to the index before a merge was run) and the current index
428 * (reflecting the changes brought in by the merge).
429 */
430 - diff_setup(&diff_opts);
430 + repo_diff_setup(the_repository, &diff_opts);
431 diff_opts.flags.recursive = 1;
432 diff_opts.detect_rename = 0;
433 diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
contrib/coccinelle/the_repository.cocci
+4
@@ -73,6 +73,10 @@
73 |
74 - get_commit_tree
75 + repo_get_commit_tree
76 +// diff.h
77 +|
78 +- diff_setup
79 ++ repo_diff_setup
80 )
81 (
82 + the_repository,
contrib/coccinelle/the_repository.pending.cocci
-4
@@ -5,11 +5,7 @@
5 @@
6 @@
7 (
8 -// diff.h
9 -- diff_setup
10 -+ repo_diff_setup
8 // object-store.h
12 -|
9 - read_object_file
10 + repo_read_object_file
11 |
diff.h
-3
@@ -535,9 +535,6 @@ int git_diff_basic_config(const char *var, const char *value, void *cb);
535 int git_diff_heuristic_config(const char *var, const char *value, void *cb);
536 void init_diff_ui_defaults(void);
537 int git_diff_ui_config(const char *var, const char *value, void *cb);
538 -#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
539 -#define diff_setup(diffopts) repo_diff_setup(the_repository, diffopts)
540 -#endif
538 void repo_diff_setup(struct repository *, struct diff_options *);
539 struct option *add_diff_options(const struct option *, struct diff_options *);
540 int diff_opt_parse(struct diff_options *, const char **, int, const char *);
log-tree.c
+1 -1
@@ -849,7 +849,7 @@ void show_log(struct rev_info *opt)
849 * Pass minimum required diff-options to range-diff; others
850 * can be added later if deemed desirable.
851 */
852 - diff_setup(&opts);
852 + repo_diff_setup(the_repository, &opts);
853 opts.file = opt->diffopt.file;
854 opts.use_color = opt->diffopt.use_color;
855 diff_setup_done(&opts);
range-diff.c
+1 -1
@@ -485,7 +485,7 @@ static void output(struct string_list *a, struct string_list *b,
485 if (range_diff_opts->diffopt)
486 memcpy(&opts, range_diff_opts->diffopt, sizeof(opts));
487 else
488 - diff_setup(&opts);
488 + repo_diff_setup(the_repository, &opts);
489
490 opts.no_free = 1;
491 if (!opts.output_format)