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

Apply the part of "the_repository.pending.cocci" pertaining to "packfile.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 afe27c889429438829bc8818ed17e4960bd3ef02
5 files changed +6 -7
builtin/gc.c
+1 -1
@@ -284,7 +284,7 @@ static uint64_t total_ram(void)
284
285 static uint64_t estimate_repack_memory(struct packed_git *pack)
286 {
287 - unsigned long nr_objects = approximate_object_count();
287 + unsigned long nr_objects = repo_approximate_object_count(the_repository);
288 size_t os_cache, heap;
289
290 if (!pack || !nr_objects)
commit-graph.c
+1 -1
@@ -2360,7 +2360,7 @@ int write_commit_graph(struct object_directory *odb,
2360 replace = ctx->opts->split_flags & COMMIT_GRAPH_SPLIT_REPLACE;
2361 }
2362
2363 - ctx->approx_nr_objects = approximate_object_count();
2363 + ctx->approx_nr_objects = repo_approximate_object_count(the_repository);
2364
2365 if (ctx->append && ctx->r->objects->commit_graph) {
2366 struct commit_graph *g = ctx->r->objects->commit_graph;
contrib/coccinelle/the_repository.cocci
+4
@@ -91,6 +91,10 @@
91 |
92 - format_commit_message
93 + repo_format_commit_message
94 +// packfile.h
95 +|
96 +- approximate_object_count
97 ++ repo_approximate_object_count
98 )
99 (
100 + the_repository,
contrib/coccinelle/the_repository.pending.cocci
-4
@@ -5,11 +5,7 @@
5 @@
6 @@
7 (
8 -// packfile.h
9 -- approximate_object_count
10 -+ repo_approximate_object_count
8 // promisor-remote.h
12 -|
9 - promisor_remote_reinit
10 + repo_promisor_remote_reinit
11 |
packfile.h
-1
@@ -65,7 +65,6 @@ struct packed_git *get_all_packs(struct repository *r);
65 * for speed.
66 */
67 unsigned long repo_approximate_object_count(struct repository *r);
68 -#define approximate_object_count() repo_approximate_object_count(the_repository)
68
69 struct packed_git *find_sha1_pack(const unsigned char *sha1,
70 struct packed_git *packs);