Subject: Re: [PATCH 07/16] repack: track the ODB source via existing_packs

From: Taylor Blau <[email-masked]>
Date: Tue, 14 Apr 2026 18:24:12 -0400

On Tue, Apr 07, 2026 at 02:04:39AM -0400, Jeff King wrote:
> Makes sense. I wonder if we still need the repo field here:
>
> > diff --git a/repack.h b/repack.h
> > index bc9f2e1a5de..c0e9f0ca647 100644
> > --- a/repack.h
> > +++ b/repack.h
> > @@ -56,6 +56,7 @@ struct packed_git;
> >
> >  struct existing_packs {
> >  	struct repository *repo;
> > +	struct odb_source *source;
> >  	struct string_list kept_packs;
> >  	struct string_list non_kept_packs;
> >  	struct string_list cruft_packs;
>
> since we are going to mostly be operating on one odb source. But I think
> it gets weird asking about things like "which hash algorithm to use",
> because then you end up back at source->odb->repo. Plus there are some
> parts that seem to look at the whole repo.

I think that doing so is possible, though it's not totally
straightforward. There are a handful of places where you really truly
do want to work with the repo (e.g., when calling trace2_region_enter(),
which requires a repository pointer as its final argument).

I do think that we are probably over-relying on the repository pointer
in the existing_packs struct after this patch, especially with the ODB
source refactorings that have been going on.

> So I think it gets complicated and is well off the path to our goal, so
> not worth thinking further about for now.

I agree.

Thanks,
Taylor