From: Patrick Steinhardt <ps@pks.im>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 2/5] odb/source: introduce error status when reading objects
Date: Thu, 20 Aug 2026 16:22:35 +0200 [thread overview]
Message-ID: <aocNq1N9MWS4BeaJ@pks.im> (raw)
In-Reply-To: <CAOLa=ZSCf3CvTwtgj7RXncT6zPhyp4EX9r=g55uD+mTA1zp-5w@mail.gmail.com>
On Thu, Aug 20, 2026 at 08:41:10AM -0400, Karthik Nayak wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > The `read_object_info()` callback of `struct odb_source` is documented
> > to return a negative error code in case reading the object has failed,
> > and zero otherwise. This is overly broad though, as there are two very
> > different kinds of failures:
> >
> > - The object may not exist in the source at all.
> >
> > - The object exists, but reading it has failed, for example because
> > its on-disk state is corrupt.
> >
> > This distinction matters to callers: when an object is corrupt in one
> > source we may still find a good copy of it in another source, so we may
> > still be able to proceed with a given operation.
> >
>
> But isn't that the same for an object not existing in a source? If it
> doesn't exist in one source, we may find a good copy of it in another?
Yeah, that paragraph is a bit odd indeed. What I really wanted to say is
that the failure mode is different depending on whether the object is
found at all: if it's not then we'd fail gracefully, if it is but it's
corrupt then we die.
> > diff --git a/odb.c b/odb.c
> > index caf1d0f542..1b37b26376 100644
> > --- a/odb.c
> > +++ b/odb.c
> > @@ -696,12 +696,12 @@ static int oid_object_info_convert(struct repository *r,
> > return ret;
> > }
> >
>
> Here and elsewhere. Shouldn't we explicitly return ODB_READ_OK or
> ODB_READ_ERROR instead of relying on implicit conversion?
I didn't want to go through the complete callchain to make sure that we
explicitly return those values. I think it'd be mostly pointless: the
return code convention is established enough, and all callers already
return the expected values anyway, even though they're not using the
enum now.
Patrick
next prev parent reply other threads:[~2026-08-20 14:22 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 14:19 [PATCH 0/7] odb: handle `OBJECT_INFO_DIE_IF_CORRUPT` generically Patrick Steinhardt
2026-08-18 14:19 ` [PATCH 1/7] odb/source: discern missing and corrupt objects Patrick Steinhardt
2026-08-18 18:00 ` Junio C Hamano
2026-08-19 10:01 ` Patrick Steinhardt
2026-08-18 14:19 ` [PATCH 2/7] odb/source-inmemory: signal missing objects via positive return Patrick Steinhardt
2026-08-18 18:05 ` Junio C Hamano
2026-08-19 10:01 ` Patrick Steinhardt
2026-08-18 14:19 ` [PATCH 3/7] odb/source-packed: flag known-bad objects as corrupt and not missing Patrick Steinhardt
2026-08-18 18:17 ` Junio C Hamano
2026-08-19 10:01 ` Patrick Steinhardt
2026-08-19 17:42 ` Junio C Hamano
2026-08-18 14:19 ` [PATCH 4/7] odb/source-loose: distinguish missing and corrupt objects Patrick Steinhardt
2026-08-18 18:23 ` Junio C Hamano
2026-08-18 14:19 ` [PATCH 5/7] odb/source-files: signal mark objects via positive return Patrick Steinhardt
2026-08-18 18:58 ` Junio C Hamano
2026-08-19 10:01 ` Patrick Steinhardt
2026-08-18 14:19 ` [PATCH 6/7] odb/source: allow `read_object_info()` to bubble up error messages Patrick Steinhardt
2026-08-18 14:19 ` [PATCH 7/7] odb: handle `OBJECT_INFO_DIE_IF_CORRUPT` generically Patrick Steinhardt
2026-08-19 12:17 ` [PATCH v2 0/5] " Patrick Steinhardt
2026-08-19 12:17 ` [PATCH v2 1/5] odb/source-packed: flag known-bad objects as corrupt and not missing Patrick Steinhardt
2026-08-19 12:17 ` [PATCH v2 2/5] odb/source: introduce error status when reading objects Patrick Steinhardt
2026-08-20 12:41 ` Karthik Nayak
2026-08-20 14:22 ` Patrick Steinhardt [this message]
2026-08-19 12:17 ` [PATCH v2 3/5] odb/source: let callers discern missing and corrupt objects Patrick Steinhardt
2026-08-20 12:56 ` Karthik Nayak
2026-08-20 14:22 ` Patrick Steinhardt
2026-08-19 12:17 ` [PATCH v2 4/5] odb/source: allow `read_object_info()` to bubble up error messages Patrick Steinhardt
2026-08-19 12:17 ` [PATCH v2 5/5] odb: handle `OBJECT_INFO_DIE_IF_CORRUPT` generically Patrick Steinhardt
2026-08-20 14:14 ` [PATCH v2 0/5] " Karthik Nayak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aocNq1N9MWS4BeaJ@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=karthik.188@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox