From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/7] odb/source-inmemory: signal missing objects via positive return
Date: Wed, 19 Aug 2026 12:01:12 +0200 [thread overview]
Message-ID: <aoV-6ClUIPYh_-OJ@pks.im> (raw)
In-Reply-To: <xmqqcxvfz4lu.fsf@gitster.g>
On Tue, Aug 18, 2026 at 11:05:33AM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > The in-memory source returns a negative value from its
> > `read_object_info()` callback when the object in question does not
> > exist. Adapt the callback to return a positive value for missing objects
> > according to the new calling convention.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > ---
> > odb/source-inmemory.c | 2 +-
> > t/unit-tests/u-odb-inmemory.c | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/odb/source-inmemory.c b/odb/source-inmemory.c
> > index 3e71611b8e..57183daf4d 100644
> > --- a/odb/source-inmemory.c
> > +++ b/odb/source-inmemory.c
> > @@ -66,7 +66,7 @@ static int odb_source_inmemory_read_object_info(struct odb_source *source,
> >
> > object = find_cached_object(inmemory, oid);
> > if (!object)
> > - return -1;
> > + return 1;
>
> Let's not define "any positive value means this single thing: it
> does not exist" and then return a mysterious and unspecified hard
> coded constant like this. Instead perhaps something along this
> line?
>
> enum odb_roi_status {
> ODB_ROI_SUCCESS = 0,
> ODB_ROI_MISSING = 1,
> ODB_ROI_IO_ERROR = -1,
> ...
> };
>
> As I already said, I personally prefer to define MISSING also as
> a negative value.
Fair enough, will adapt.
Patrick
next prev parent reply other threads:[~2026-08-19 10:01 UTC|newest]
Thread overview: 24+ 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 [this message]
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-19 12:17 ` [PATCH v2 3/5] odb/source: let callers discern missing and corrupt objects 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
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=aoV-6ClUIPYh_-OJ@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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