From: Junio C Hamano Date: Thu, 18 Dec 2025 07:23:03 GMT Subject: Re: [PATCH 2/8] packfile: always declare object info to be OI_PACKED Message-ID: In-Reply-To: <20251218-b4-pks-odb-read-object-info-improvements-v1-2-81c8368492be@pks.im> Patrick Steinhardt writes: > When reading object info via a packfile we yield one of two types: > > - The object can either be OI_PACKED, which is what a caller would > typically expect. > > - Or it can be OI_DBCACHED if it is stored in the delta base cache. > > The latter really is an implementation detail though, and callers > typically don't care at all about the difference. Furthermore, the > information whether or not it is part of the delta base cache can > already be derived via the `is_delta` field, so the fact that we discern > between OI_PACKED and OI_DBCACHED only further complicates the > interface. If this were "and no existing callers check at all", it would be trivial to decide for this change. In fact you do say that but in a weaker form just below. > Drop the OI_DBCACHED enum completely. There don't seem to be any callers > that care about the distinction. "git grep OI_DBCACHED" shows only a single hit, which is what you are getting rid of in this patch, but I cannot claim that we did a sufficient audit, as this change will break code paths that check if they got OI_PACKED and do something differently (or if what they got is different from OI_PACKED, for that matter). > > Signed-off-by: Patrick Steinhardt > --- > odb.h | 1 - > packfile.c | 3 +-- > 2 files changed, 1 insertion(+), 3 deletions(-) > > diff --git a/odb.h b/odb.h > index 014cd9585a..73b0b87ad5 100644 > --- a/odb.h > +++ b/odb.h > @@ -330,7 +330,6 @@ struct object_info { > OI_CACHED, > OI_LOOSE, > OI_PACKED, > - OI_DBCACHED > } whence; > union { > /* > diff --git a/packfile.c b/packfile.c > index c88bd92619..79ad9d7179 100644 > --- a/packfile.c > +++ b/packfile.c > @@ -1656,8 +1656,7 @@ int packed_object_info(struct repository *r, struct packed_git *p, > oidclr(oi->delta_base_oid, p->repo->hash_algo); > } > > - oi->whence = in_delta_base_cache(p, obj_offset) ? OI_DBCACHED : > - OI_PACKED; > + oi->whence = OI_PACKED; > > out: > unuse_pack(&w_curs);