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>
main
Taylor Blau 2025-10-15 18:27:21 -04:00 committed by Junio C Hamano
parent 20b4eeddce
commit df3a499bd6
1 changed files with 5 additions and 3 deletions

View File

@ -126,6 +126,7 @@ static void pack_objects_args_release(struct pack_objects_args *args)
}

struct existing_packs {
struct repository *repo;
struct string_list kept_packs;
struct string_list non_kept_packs;
struct string_list cruft_packs;
@ -265,7 +266,7 @@ static void existing_packs_release(struct existing_packs *existing)
static void collect_pack_filenames(struct existing_packs *existing,
const struct string_list *extra_keep)
{
struct packfile_store *packs = the_repository->objects->packfiles;
struct packfile_store *packs = existing->repo->objects->packfiles;
struct packed_git *p;
struct strbuf buf = STRBUF_INIT;

@ -498,7 +499,7 @@ static void init_pack_geometry(struct pack_geometry *geometry,
struct existing_packs *existing,
const struct pack_objects_args *args)
{
struct packfile_store *packs = the_repository->objects->packfiles;
struct packfile_store *packs = existing->repo->objects->packfiles;
struct packed_git *p;
struct strbuf buf = STRBUF_INIT;

@ -1139,7 +1140,7 @@ static int write_filtered_pack(const struct pack_objects_args *args,
static void combine_small_cruft_packs(FILE *in, size_t combine_cruft_below_size,
struct existing_packs *existing)
{
struct packfile_store *packs = the_repository->objects->packfiles;
struct packfile_store *packs = existing->repo->objects->packfiles;
struct packed_git *p;
struct strbuf buf = STRBUF_INIT;
size_t i;
@ -1405,6 +1406,7 @@ int cmd_repack(int argc,
packtmp_name = xstrfmt(".tmp-%d-pack", (int)getpid());
packtmp = mkpathdup("%s/%s", packdir, packtmp_name);

existing.repo = repo;
collect_pack_filenames(&existing, &keep_pack_list);

if (geometry.split_factor) {