Re: [PATCH 4/5] odb: remove read loop for found objects
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 14, 2026, 06:56 UTC
- Message-ID
- <as8niG1LrNqxfRzV@pks.im>
- In-Reply-To
- <as6kNufOqLFeBoNh@denethor>
On Tue, Oct 13, 2026 at 04:48:23PM -0500, Justin Tobler wrote:
Show 32 quoted lines
> On 26/10/13 09:36AM, Patrick Steinhardt wrote:
> > diff --git a/odb.c b/odb.c
> > index 69a4c203bc..095183aec0 100644
> > --- a/odb.c
> > +++ b/odb.c
> > @@ -265,7 +265,6 @@ static enum odb_read_status do_oid_object_info_extended(struct object_database *
> > struct strbuf corrupt_err = STRBUF_INIT;
> > const struct object_id *real = oid;
> > enum odb_read_status ret;
> > - int already_retried = 0;
> > bool corrupt = false;
> >
> > if (flags & OBJECT_INFO_LOOKUP_REPLACE)
> > @@ -277,38 +276,39 @@ static enum odb_read_status do_oid_object_info_extended(struct object_database *
> > if (!odb_source_read_object_info(odb->inmemory_objects, oid, oi, flags, NULL))
> > return 0;
> >
> > - while (1) {
> > + ret = odb_source_read_object_info(odb->source, real, oi, flags,
> > + &corrupt_err);
>
> Here is try to read the object, the backend is responsible for handling
> any retries internally that it cares about.
>
> > + if (!ret)
> > + goto out;
> > + if (ret != ODB_READ_NOT_FOUND)
> > + corrupt = true;
>
> If the repsitory is correct, does it even make sense to continue to try
> and fetch the missing object? I wonder if we should set `ret =
> ODB_READ_ERROR` and `goto out`?I think I tend to agree. I don't want to do it as part of this commit though, which is a plain refactoring that shouldn't change semantics. I'll add a commit on top though.
Patrick