Subject: Re: [PATCH v2 06/16] odb: move kept cache into `struct packfile_store`

From: Taylor Blau <[email-masked]>
Date: Mon, 25 Aug 2025 21:46:07 -0400

On Thu, Aug 21, 2025 at 09:39:04AM +0200, Patrick Steinhardt wrote:
> The object database tracks a cache of "kept" packfiles, which is used by
> git-pack-objects(1) to handle cruft objects. With the introduction of
> the `struct packfile_store` we have a better place to host this cache
> though.
>
> Move the cache accordingly.

This all looks good to me, thanks for taking care to preserve the
kept-pack cache's behavior.

> This moves the last bit of packfile-related state from the object
> database into the packfile store. Adapt the comment for the `packfiles`
> pointer in `struct object_database` to reflect this.

Thanks for keeping the comment up-to-date :-).

> diff --git a/packfile.h b/packfile.h
> index d48d46cc1b..74cea1a4a9 100644
> --- a/packfile.h
> +++ b/packfile.h
> @@ -64,6 +64,11 @@ struct packfile_store {
>  	 */
>  	struct packed_git *packs;
>
> +	struct {
> +		struct packed_git **packs;
> +		unsigned flags;
> +	} kept_cache;
> +

This wouldn't be a bad time to add a comment here explaining what the
kept_cache is for and what each of the struct's members represent. We
can blame (at least one of) the author(s) of 20b031fede (packfile: add
kept-pack cache for find_kept_pack_entry(), 2021-02-22) for omitting it
in the first place ;-).

Thanks,
Taylor