From: Junio C Hamano <gitster@pobox.com>
To: Derrick Stolee <stolee@gmail.com>
Cc: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Subject: Re: [PATCH 1/3] builtin/backfill: fix flags passed to `odb_has_object()`
Date: Mon, 26 Jan 2026 13:07:39 -0800 [thread overview]
Message-ID: <xmqqwm14gk10.fsf@gitster.g> (raw)
In-Reply-To: <a5b456dc-2158-4f9a-addd-12fb9f408edf@gmail.com> (Derrick Stolee's message of "Mon, 26 Jan 2026 15:17:45 -0500")
Derrick Stolee <stolee@gmail.com> writes:
> On 1/26/2026 7:17 AM, Patrick Steinhardt wrote:
>> The function `fill_missing_blobs()` receives an array of object IDs and
>> verifies for each of them whether the corresponding object exists. If it
>> doesn't exist, we add it to a set of objects and then batch-fetch all of
>> the objects at once.
>>
>> The check for whether or not we already have the object is broken
>> though: we pass `OBJECT_INFO_FOR_PREFETCH`, but `odb_has_object()`
>> expects us to pass `HAS_OBJECT_*` flags. The flag expands to:
>>
>> - `OBJECT_INFO_QUICK`, which asks the object database to not reprepare
>> in case the object wasn't found. This makes sense, as we'd otherwise
>> reprepare the object database as many times as we have missing
>> objects.
>>
>> - `OBJECT_INFO_SKIP_FETCH_OBJECT`, which asks the object database to
>> not fetch the object in case it's missing. Again, this makes sense,
>> as we want to batch-fetch the objects.
>>
>> This shows that we indeed want the equivalent of this flag, but of
>> course represented as `HAS_OBJECT_*` flags.
>>
>> Luckily, the code is already working correctly. The `OBJECT_INFO` flag
>> expands to `(1 << 3) | (1 << 4)`, none of which are valid `HAS_OBJECT`
>> flags. And if no flags are passed, `odb_has_object()` ends up calling
>> `odb_read_object_info_extended()` with exactly the above two flags that
>> we wanted to set in the first place.
>>
>> Of course, this is pure luck, and this can break any moment. So let's
>> fix this and correct the code to not pass any flags at all.
>
> Absolutely the right fix for this case. Thanks!
>
> -Stolee
Thanks, both.
next prev parent reply other threads:[~2026-01-26 21:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 12:17 [PATCH 0/3] Small fixups for `OBJECT_INFO` flags Patrick Steinhardt
2026-01-26 12:17 ` [PATCH 1/3] builtin/backfill: fix flags passed to `odb_has_object()` Patrick Steinhardt
2026-01-26 20:17 ` Derrick Stolee
2026-01-26 21:07 ` Junio C Hamano [this message]
2026-02-09 19:57 ` Justin Tobler
2026-02-10 9:24 ` Karthik Nayak
2026-02-10 9:32 ` Karthik Nayak
2026-01-26 12:17 ` [PATCH 2/3] builtin/fsck: " Patrick Steinhardt
2026-02-09 20:04 ` Justin Tobler
2026-01-26 12:17 ` [PATCH 3/3] odb: drop gaps in object info flag values Patrick Steinhardt
2026-01-26 16:58 ` Junio C Hamano
2026-01-26 18:02 ` René Scharfe
2026-01-26 18:13 ` Junio C Hamano
2026-01-27 6:29 ` Patrick Steinhardt
2026-02-09 20:32 ` Justin Tobler
2026-02-09 20:18 ` Justin Tobler
2026-01-26 16:28 ` [PATCH 0/3] Small fixups for `OBJECT_INFO` flags Junio C Hamano
2026-02-12 6:59 ` [PATCH v2 0/5] " Patrick Steinhardt
2026-02-12 6:59 ` [PATCH v2 1/5] builtin/backfill: fix flags passed to `odb_has_object()` Patrick Steinhardt
2026-02-12 6:59 ` [PATCH v2 2/5] builtin/fsck: " Patrick Steinhardt
2026-02-12 6:59 ` [PATCH v2 3/5] odb: drop gaps in object info flag values Patrick Steinhardt
2026-02-12 6:59 ` [PATCH v2 4/5] odb: convert object info flags into an enum Patrick Steinhardt
2026-02-12 6:59 ` [PATCH v2 5/5] odb: convert `odb_has_object()` " 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=xmqqwm14gk10.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
--cc=stolee@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