From: Karthik Nayak Date: Wed, 20 Aug 2025 13:17:47 GMT Subject: Re: [PATCH 09/16] packfile: split up responsibilities of `reprepare_packed_git()` Message-ID: In-Reply-To: <20250819-b4-pks-packfiles-store-v1-9-1660842e125a@pks.im> Patrick Steinhardt writes: > In `reprepare_packed_git()` we perform a couple of operations: > > - We reload alternate object directories. > > - We clear the loose object cache. > > - We reprepare packfiles. > > While the logic is hosted in "packfile.c", it clearly reaches into other > subsystems that aren't related to packfiles. > > Split up the responsibility and introduce `odb_reprepare()` which now > becomes responsible for repreparing the whole object database. The > existing `reprepare_packed_git()` function is refactored accordingly and > only cares about reloading the packfile store now. [snip] > diff --git a/odb.h b/odb.h > index f1736b067c..9810ec60a0 100644 > --- a/odb.h > +++ b/odb.h > @@ -155,6 +155,12 @@ struct object_database { > struct object_database *odb_new(struct repository *repo); > void odb_clear(struct object_database *o); > > +/* > + * Clear caches, reload alternates and then reload object sources so that new > + * objects may become accessible. > + */ > +void odb_reprepare(struct object_database *o); > I was first wondering why you don't go into details like mentioning the packile cleanup. But since we eventually will move it into its own object source, this reads better.