From: Jeff King Date: Tue, 07 Apr 2026 06:04:39 GMT Subject: Re: [PATCH 07/16] repack: track the ODB source via existing_packs Message-ID: <20260407060439.GB714878@coredump.intra.peff.net> In-Reply-To: <2d377f534071ad9def3fb4860b2581197d02726b.1774820449.git.me@ttaylorr.com> On Sun, Mar 29, 2026 at 05:41:08PM -0400, Taylor Blau wrote: > Store the ODB source in the `existing_packs` struct and use that in > place of the raw `repo->objects->sources` access within `cmd_repack()`. > > The source used is still assigned from the first source in the list, so > there are no functional changes in this commit. The changes instead > serve two purposes (one immediate, one not): > > - The incremental MIDX-based repacking machinery will need to know what > source is being used to read the existing MIDX/chain (should one > exist). > > - In the future, if "git repack" is taught how to operate on other > object sources, this field will serve as the authoritative value for > that source. 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. So I think it gets complicated and is well off the path to our goal, so not worth thinking further about for now. -Peff