Subject: Re: [PATCH 03/10] packfile: refactor kept-pack cache to work with packfile stores

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 16 Dec 2025 10:09:14 +0100

On Mon, Dec 15, 2025 at 03:56:25PM -0600, Justin Tobler wrote:
> On 25/12/15 08:36AM, Patrick Steinhardt wrote:
> > diff --git a/packfile.h b/packfile.h
> > index 33cc1c1654..701a3b4946 100644
> > --- a/packfile.h
> > +++ b/packfile.h
> > @@ -210,6 +210,19 @@ struct packed_git *packfile_store_load_pack(struct packfile_store *store,
> >  int packfile_store_freshen_object(struct packfile_store *store,
> >  				  const struct object_id *oid);
> >  
> > +enum kept_pack_type {
> > +	KEPT_PACK_ON_DISK = (1 << 0),
> > +	KEPT_PACK_IN_CORE = (1 << 1),
> > +};
> 
> Looks like while we are here we are renaming some existing flags and
> storing them in an enum instead. Makes sense, but maybe we should also
> explicitly mention this in the commit message since much of the fallout
> in the diff relates to this change.

Fair, will add to the message.

> > +
> > +/*
> > + * Retrieve the cache of kept packs from the given packfile store. Accepts a
> > + * combination of `kept_pack_type` flags. The cache is computed on demand and
> > + * will be recomputed whenever the flags change.
> > + */
> > +struct packed_git **packfile_store_get_kept_pack_cache(struct packfile_store *store,
> > +						       unsigned flags);
> 
> Now the kept cache is accessed through the packfile store instead of the
> repository. Make sense.
> 
> Since we are also changing the name from `kept_pack_cache()`, there are
> some comments in "packfile.h" that are now outdated. We may want to
> update them here.

Ah, indeed, thanks for catching! I've made the changes locally, but will
hold off sending them until I've got more feedback.

Patrick