builtin/repack.c: avoid "the_repository" in existing packs API
There are a number of spots within builtin/repack.c which refer to "the_repository", and either make use of the "existing packs" API or otherwise have a 'struct existing_packs *' in scope. Add a "repo" member to "struct existing_packs" and use that instead of "the_repository" in such locations. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Taylor Blau committed
Oct 15, 2025 at 18:27 UTC
df3a499bd6b951a9e23894793afec11f0850834a
1 file changed
+5
-3
builtin/repack.c
+5
-3
@@ -126,6 +126,7 @@ static void pack_objects_args_release(struct pack_objects_args *args)
126
}
127
128
struct existing_packs {
129
+ struct repository *repo;
130
struct string_list kept_packs;
131
struct string_list non_kept_packs;
132
struct string_list cruft_packs;
@@ -265,7 +266,7 @@ static void existing_packs_release(struct existing_packs *existing)
266
static void collect_pack_filenames(struct existing_packs *existing,
267
const struct string_list *extra_keep)
268
{
268
- struct packfile_store *packs = the_repository->objects->packfiles;
269
+ struct packfile_store *packs = existing->repo->objects->packfiles;
270
struct packed_git *p;
271
struct strbuf buf = STRBUF_INIT;
272
@@ -498,7 +499,7 @@ static void init_pack_geometry(struct pack_geometry *geometry,
499
struct existing_packs *existing,
500
const struct pack_objects_args *args)
501
{
501
- struct packfile_store *packs = the_repository->objects->packfiles;
502
+ struct packfile_store *packs = existing->repo->objects->packfiles;
503
struct packed_git *p;
504
struct strbuf buf = STRBUF_INIT;
505
@@ -1139,7 +1140,7 @@ static int write_filtered_pack(const struct pack_objects_args *args,
1140
static void combine_small_cruft_packs(FILE *in, size_t combine_cruft_below_size,
1141
struct existing_packs *existing)
1142
{
1142
- struct packfile_store *packs = the_repository->objects->packfiles;
1143
+ struct packfile_store *packs = existing->repo->objects->packfiles;
1144
struct packed_git *p;
1145
struct strbuf buf = STRBUF_INIT;
1146
size_t i;
@@ -1405,6 +1406,7 @@ int cmd_repack(int argc,
1406
packtmp_name = xstrfmt(".tmp-%d-pack", (int)getpid());
1407
packtmp = mkpathdup("%s/%s", packdir, packtmp_name);
1408
1409
+ existing.repo = repo;
1410
collect_pack_filenames(&existing, &keep_pack_list);
1411
1412
if (geometry.split_factor) {