aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2025-10-15 18:27:21 -0400
committerJunio C Hamano <gitster@pobox.com>2025-10-16 10:08:53 -0700
commitdf3a499bd6b951a9e23894793afec11f0850834a (patch)
tree74edd6718689ad863e2b471474f40213678e5491
parent20b4eeddce165f11d7c5bffb1ecb69017df4a05e (diff)
downloadgit-df3a499bd6b951a9e23894793afec11f0850834a.tar.gz
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>
-rw-r--r--builtin/repack.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index 305782b2c9..7223553bed 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -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) {