From: Patrick Steinhardt <ps@pks.im>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 01/10] builtin/fsck: use `fsck_obj_buffer()` when checking loose objects
Date: Mon, 31 Aug 2026 08:00:24 +0200 [thread overview]
Message-ID: <apUYeK7IvIfaxdtf@pks.im> (raw)
In-Reply-To: <CAOLa=ZQyGk65qhF2uRV6Q48c_F948XuTWOdHOTwenfGestLxWw@mail.gmail.com>
On Thu, Aug 27, 2026 at 06:00:37AM -0400, Karthik Nayak wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > When checking loose objects we manually parse the object buffer we have
> > read from the on-disk file, mark the object and then call `fsck_obj()`.
> > Almost the exact same steps are also performed by `fsck_obj_buffer()`.
> >
>
> I was wondering what the difference was, there seems to be none, nit:
> perhaps we can drop 'Almost'.
I actually didn't have the "almost" initially but added it later, but
there isn't really much of a reason why specifically I did so. I'll drop
it again.
> > diff --git a/builtin/fsck.c b/builtin/fsck.c
> > index 892c5661d9..3c4127f4d8 100644
> > --- a/builtin/fsck.c
> > +++ b/builtin/fsck.c
> > @@ -751,21 +750,7 @@ static int fsck_loose(const struct object_id *oid, const char *path,
> > if (!contents && type != OBJ_BLOB)
> > BUG("read_loose_object streamed a non-blob");
> >
> > - obj = parse_object_buffer(data->repo, oid, type, size,
> > - contents, &eaten);
> > -
> > - if (!obj) {
> > - errors_found |= ERROR_OBJECT;
> > - error(_("%s: object could not be parsed: %s"),
> > - oid_to_hex(oid), path);
> > - if (!eaten)
> > - free(contents);
>
> This is now moved to the bottom below fsck_obj_buffer() call. So that's
> okay.
>
> > - return 0; /* keep checking other objects */
> > - }
> > -
> > - obj->flags &= ~(REACHABLE | SEEN);
> > - obj->flags |= HAS_OBJ;
> > - if (fsck_obj(data->repo, obj, contents, size))
> > + if (fsck_obj_buffer(oid, type, size, contents, &eaten, data->repo))
> > errors_found |= ERROR_OBJECT;
> >
>
> I see `fsck_obj_buffer()` also sets adds the `ERROR_OBJECT` flag, but
> that's okay.
Yeah. We could just drop this, but then it'd feel a tiny bit weird as we
call the function without checking its return value at all. So I decided
to just keep this as-is.
Patrick
next prev parent reply other threads:[~2026-08-31 6:00 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 14:30 [PATCH 00/10] odb: make consistency checks pluggable Patrick Steinhardt
2026-08-25 14:30 ` [PATCH 01/10] builtin/fsck: use `fsck_obj_buffer()` when checking loose objects Patrick Steinhardt
2026-08-27 10:00 ` Karthik Nayak
2026-08-31 6:00 ` Patrick Steinhardt [this message]
2026-08-25 14:30 ` [PATCH 02/10] builtin/fsck: merge `fsck_obj_buffer()` and `fsck_obj()` Patrick Steinhardt
2026-08-27 10:03 ` Karthik Nayak
2026-08-31 6:00 ` Patrick Steinhardt
2026-08-25 14:30 ` [PATCH 03/10] builtin/fsck: de-globalize option handling Patrick Steinhardt
2026-08-27 10:05 ` Karthik Nayak
2026-08-25 14:30 ` [PATCH 04/10] builtin/fsck: don't check alternates with "--no-full" Patrick Steinhardt
2026-08-27 10:12 ` Karthik Nayak
2026-08-31 6:00 ` Patrick Steinhardt
2026-08-25 14:30 ` [PATCH 05/10] odb: provide infrastructure for pluggable fsck checks Patrick Steinhardt
2026-08-27 10:49 ` Karthik Nayak
2026-08-31 6:00 ` Patrick Steinhardt
2026-08-25 14:30 ` [PATCH 06/10] builtin/fsck: move packfile verification into the packed source Patrick Steinhardt
2026-08-25 14:30 ` [PATCH 07/10] builtin/fsck: move reverse index " Patrick Steinhardt
2026-08-25 14:30 ` [PATCH 08/10] builtin/fsck: move bitmap " Patrick Steinhardt
2026-08-27 10:54 ` Karthik Nayak
2026-08-31 6:00 ` Patrick Steinhardt
2026-08-31 9:26 ` Karthik Nayak
2026-08-25 14:30 ` [PATCH 09/10] builtin/fsck: move multi-pack index " Patrick Steinhardt
2026-08-25 14:30 ` [PATCH 10/10] builtin/fsck: move loose object verification into the loose source Patrick Steinhardt
2026-08-27 10:58 ` [PATCH 00/10] odb: make consistency checks pluggable Karthik Nayak
2026-08-31 6:46 ` [PATCH v2 " Patrick Steinhardt
2026-08-31 6:46 ` [PATCH v2 01/10] builtin/fsck: use `fsck_obj_buffer()` when checking loose objects Patrick Steinhardt
2026-08-31 6:46 ` [PATCH v2 02/10] builtin/fsck: merge `fsck_obj_buffer()` and `fsck_obj()` Patrick Steinhardt
2026-08-31 6:46 ` [PATCH v2 03/10] builtin/fsck: de-globalize option handling Patrick Steinhardt
2026-08-31 6:46 ` [PATCH v2 04/10] builtin/fsck: don't check alternates with "--no-full" Patrick Steinhardt
2026-08-31 6:46 ` [PATCH v2 05/10] odb: provide infrastructure for pluggable fsck checks Patrick Steinhardt
2026-09-11 11:14 ` Toon Claes
2026-09-11 12:23 ` Patrick Steinhardt
2026-08-31 6:46 ` [PATCH v2 06/10] builtin/fsck: move packfile verification into the packed source Patrick Steinhardt
2026-08-31 6:46 ` [PATCH v2 07/10] builtin/fsck: move reverse index " Patrick Steinhardt
2026-09-11 11:14 ` Toon Claes
2026-08-31 6:46 ` [PATCH v2 08/10] builtin/fsck: move bitmap " Patrick Steinhardt
2026-08-31 6:46 ` [PATCH v2 09/10] builtin/fsck: move multi-pack index " Patrick Steinhardt
2026-09-11 11:14 ` Toon Claes
2026-09-11 12:23 ` Patrick Steinhardt
2026-08-31 6:46 ` [PATCH v2 10/10] builtin/fsck: move loose object verification into the loose source Patrick Steinhardt
2026-09-11 11:15 ` Toon Claes
2026-09-11 12:23 ` Patrick Steinhardt
2026-08-31 9:26 ` [PATCH v2 00/10] odb: make consistency checks pluggable Karthik Nayak
2026-09-11 13:27 ` [PATCH v3 " Patrick Steinhardt
2026-09-11 13:27 ` [PATCH v3 01/10] builtin/fsck: use `fsck_obj_buffer()` when checking loose objects Patrick Steinhardt
2026-09-11 13:27 ` [PATCH v3 02/10] builtin/fsck: merge `fsck_obj_buffer()` and `fsck_obj()` Patrick Steinhardt
2026-09-11 13:27 ` [PATCH v3 03/10] builtin/fsck: de-globalize option handling Patrick Steinhardt
2026-09-11 13:27 ` [PATCH v3 04/10] builtin/fsck: don't check alternates with "--no-full" Patrick Steinhardt
2026-09-11 13:27 ` [PATCH v3 05/10] odb: provide infrastructure for pluggable fsck checks Patrick Steinhardt
2026-09-11 13:27 ` [PATCH v3 06/10] builtin/fsck: move packfile verification into the packed source Patrick Steinhardt
2026-09-11 13:27 ` [PATCH v3 07/10] builtin/fsck: move reverse index " Patrick Steinhardt
2026-09-11 13:27 ` [PATCH v3 08/10] builtin/fsck: move bitmap " Patrick Steinhardt
2026-09-11 13:27 ` [PATCH v3 09/10] builtin/fsck: move multi-pack index " Patrick Steinhardt
2026-09-11 13:27 ` [PATCH v3 10/10] builtin/fsck: move loose object verification into the loose source 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=apUYeK7IvIfaxdtf@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--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