Subject: Re: [PATCH v2 07/10] packfile: only prepare owning store in `packfile_store_prepare()`

From: Toon Claes <[email-masked]>
Date: Wed, 07 Jan 2026 14:15:54 +0100

Patrick Steinhardt <[email-masked]> writes:

> When calling `packfile_store_prepare()` we prepare not only the provided
> packfile store, but also all those of all other sources part of the same
> object database. This was required when the store was still sitting on
> the object database level. But now that it sits on the source level it's
> not anymore.
>
> Refactor the code so that we only prepare the single packfile store
> passed by the caller. Adapt callers accordingly.
>
> Signed-off-by: Patrick Steinhardt <[email-masked]>
> ---
>  builtin/grep.c | 14 ++++++++------
>  packfile.c     | 19 +++++--------------
>  2 files changed, 13 insertions(+), 20 deletions(-)
>
> diff --git a/builtin/grep.c b/builtin/grep.c
> index 4855b871dd..5b8b87b1ac 100644
> --- a/builtin/grep.c
> +++ b/builtin/grep.c
> @@ -1213,12 +1213,14 @@ int cmd_grep(int argc,
>  		 */
>  		if (recurse_submodules)
>  			repo_read_gitmodules(the_repository, 1);
> -		/*
> -		 * Note: `packfile_store_prepare()` prepares stores from all
> -		 * sources. This will be fixed in a subsequent commit.
> -		 */
> -		if (startup_info->have_repository)
> -			packfile_store_prepare(the_repository->objects->sources->packfiles);
> +
> +		if (startup_info->have_repository) {
> +			struct odb_source *source;
> +
> +			odb_prepare_alternates(the_repository->objects);
> +			for (source = the_repository->objects->sources; source; source = source->next)
> +				packfile_store_prepare(source->packfiles);
> +		}

Ahha, I see what you mean in the previous commit now. Sorry, my mistake.

-- 
Cheers,
Toon