Subject: Re: [PATCH 03/16] odb: fix unnecessary call to `find_cached_object()`

From: Justin Tobler <[email-masked]>
Date: Wed, 8 Apr 2026 16:13:45 -0500

On 26/04/03 08:01AM, Patrick Steinhardt wrote:
> diff --git a/odb.c b/odb.c
> index d321242353..21cdedc31c 100644
> --- a/odb.c
> +++ b/odb.c
> @@ -774,8 +774,7 @@ int odb_pretend_object(struct object_database *odb,
>  	char *co_buf;
>  
>  	hash_object_file(odb->repo->hash_algo, buf, len, type, oid);
> -	if (odb_has_object(odb, oid, 0) ||
> -	    find_cached_object(odb, oid))
> +	if (odb_has_object(odb, oid, 0))

Nice, odb_has_object() does indeed already check the object cache so
that makes the explicit find_cached_object() redundant.

If a future where temporary objects could be written to the inmemory ODB
source, would there ever be a reason for odb_has_object() to
differentiate between inmemory and real objects?

-Justin