Re: [PATCH 03/16] odb: fix unnecessary call to `find_cached_object()`
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Apr 8, 2026, 21:13 UTC
- Message-ID
- <adbDpPQgvPfctxQS@denethor>
- In-Reply-To
- <20260403-b4-pks-odb-source-inmemory-v1-3-8b8d1abaa25e@pks.im>
On 26/04/03 08:01AM, Patrick Steinhardt wrote:
Show 11 quoted lines
> 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