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

Apply the part of "the_repository.pending.cocci" pertaining to "revision.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 035c7de9e9ea11d26df5f9e4bb117f91ed11a9fd
8 files changed +12 -25
add-interactive.c
+1 -1
@@ -551,7 +551,7 @@ static int get_modified_files(struct repository *r,
551 opt.def = is_initial ?
552 empty_tree_oid_hex() : oid_to_hex(&head_oid);
553
554 - init_revisions(&rev, NULL);
554 + repo_init_revisions(the_repository, &rev, NULL);
555 setup_revisions(0, NULL, &rev, &opt);
556
557 rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
builtin/bisect.c
+2 -2
@@ -568,7 +568,7 @@ static int prepare_revs(struct bisect_terms *terms, struct rev_info *revs)
568 * sets up a revision walk.
569 */
570 reset_revision_walk();
571 - init_revisions(revs, NULL);
571 + repo_init_revisions(the_repository, revs, NULL);
572 setup_revisions(0, NULL, revs, NULL);
573 for_each_glob_ref_in(add_bisect_ref, bad, "refs/bisect/", &cb);
574 cb.object_flags = UNINTERESTING;
@@ -1095,7 +1095,7 @@ static enum bisect_error bisect_skip(struct bisect_terms *terms, int argc,
1095 struct rev_info revs;
1096 struct commit *commit;
1097
1098 - init_revisions(&revs, NULL);
1098 + repo_init_revisions(the_repository, &revs, NULL);
1099 setup_revisions(2, argv + i - 1, &revs, NULL);
1100
1101 if (prepare_revision_walk(&revs))
builtin/stash.c
+3 -3
@@ -901,7 +901,7 @@ static int show_stash(int argc, const char **argv, const char *prefix)
901
902 init_diff_ui_defaults();
903 git_config(git_diff_ui_config, NULL);
904 - init_revisions(&rev, prefix);
904 + repo_init_revisions(the_repository, &rev, prefix);
905
906 argc = parse_options(argc, argv, prefix, options, git_stash_show_usage,
907 PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN_OPT |
@@ -1090,7 +1090,7 @@ static int check_changes_tracked_files(const struct pathspec *ps)
1090 if (repo_read_index(the_repository) < 0)
1091 return -1;
1092
1093 - init_revisions(&rev, NULL);
1093 + repo_init_revisions(the_repository, &rev, NULL);
1094 copy_pathspec(&rev.prune_data, ps);
1095
1096 rev.diffopt.flags.quick = 1;
@@ -1277,7 +1277,7 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
1277 struct strbuf diff_output = STRBUF_INIT;
1278 struct index_state istate = INDEX_STATE_INIT(the_repository);
1279
1280 - init_revisions(&rev, NULL);
1280 + repo_init_revisions(the_repository, &rev, NULL);
1281 copy_pathspec(&rev.prune_data, ps);
1282
1283 set_alternate_index_output(stash_index_path.buf);
builtin/submodule--helper.c
+1 -1
@@ -1108,7 +1108,7 @@ static int compute_summary_module_list(struct object_id *head_oid,
1108 strvec_pushv(&diff_args, info->argv);
1109
1110 git_config(git_diff_basic_config, NULL);
1111 - init_revisions(&rev, info->prefix);
1111 + repo_init_revisions(the_repository, &rev, info->prefix);
1112 rev.abbrev = 0;
1113 precompose_argv_prefix(diff_args.nr, diff_args.v, NULL);
1114 setup_revisions(diff_args.nr, diff_args.v, &rev, &opt);
contrib/coccinelle/the_repository.cocci
+4
@@ -113,6 +113,10 @@
113 |
114 - rerere
115 + repo_rerere
116 +// revision.h
117 +|
118 +- init_revisions
119 ++ repo_init_revisions
120 )
121 (
122 + the_repository,
contrib/coccinelle/the_repository.pending.cocci deleted
-14
@@ -1,14 +0,0 @@
1 -// This file is used for the ongoing refactoring of
2 -// bringing the index or repository struct in all of
3 -// our code base.
4 -
5 -@@
6 -@@
7 -(
8 -// revision.h
9 -- init_revisions
10 -+ repo_init_revisions
11 -)
12 - (
13 -+ the_repository,
14 - ...)
range-diff.c
+1 -1
@@ -588,7 +588,7 @@ int is_range_diff_range(const char *arg)
588 int i, positive = 0, negative = 0;
589 struct rev_info revs;
590
591 - init_revisions(&revs, NULL);
591 + repo_init_revisions(the_repository, &revs, NULL);
592 if (setup_revisions(3, argv, &revs, NULL) == 1) {
593 for (i = 0; i < revs.pending.nr; i++)
594 if (revs.pending.objects[i].item->flags & UNINTERESTING)
revision.h
-3
@@ -415,9 +415,6 @@ struct rev_info {
415 void repo_init_revisions(struct repository *r,
416 struct rev_info *revs,
417 const char *prefix);
418 -#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
419 -#define init_revisions(revs, prefix) repo_init_revisions(the_repository, revs, prefix)
420 -#endif
418
419 /**
420 * Parse revision information, filling in the `rev_info` structure, and