From: Karthik Nayak Date: Wed, 19 Nov 2025 14:48:24 GMT Subject: Re: [PATCH 11/18] packfile: introduce function to read object info from a store Message-ID: In-Reply-To: <20251119-b4-pks-odb-read-stream-v1-11-adacf03c2ccf@pks.im> Patrick Steinhardt writes: > Extract the logic to read object info for a packed object from > `do_oid_object_into_extended()` into a standalone function that operates > on the packfile store. This function will be used in a subsequent > commit. > > Note that this change allows us to make `find_pack_entry()` an internal > implementation detail. As a consequence though we have to move around > `packfile_store_freshen_object()` so that it is defined after that > function. > > Signed-off-by: Patrick Steinhardt > --- > odb.c | 29 ++++--------------------- > packfile.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++--------------- > packfile.h | 12 ++++++++++- > 3 files changed, 69 insertions(+), 43 deletions(-) > > diff --git a/odb.c b/odb.c > index 3ec21ef24e..f4cbee4b04 100644 > --- a/odb.c > +++ b/odb.c > @@ -666,8 +666,6 @@ static int do_oid_object_info_extended(struct object_database *odb, > { > static struct object_info blank_oi = OBJECT_INFO_INIT; > const struct cached_object *co; > - struct pack_entry e; > - int rtype; > const struct object_id *real = oid; > int already_retried = 0; > > @@ -702,8 +700,8 @@ static int do_oid_object_info_extended(struct object_database *odb, > while (1) { > struct odb_source *source; > > - if (find_pack_entry(odb->repo, real, &e)) > - break; > + if (!packfile_store_read_object_info(odb->packfiles, real, oi, flags)) > + return 0; > Earlier we would try to find the pack entry and if we did, we would break this `while` loop and fill in the object information. Now that is part of the `packfile_store_read_object_info()` function. So we simply have to loop until it returns a success. Speaking of which, the loop simply exists to capture: 1. Trying to read objects from a submodule, so we add the submodule sources and try everything again 2. If its a promisor remote, we try to fetch and try everything again. [snip] The rest looks good.