Re: [PATCH 3/7] odb/source-packed: flag known-bad objects as corrupt and not missing
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 19, 2026, 17:42 UTC
- Message-ID
- <xmqqpkzeuhuz.fsf@gitster.g>
- In-Reply-To
- <aoV--DSQq8-Krg3M@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 26 quoted lines
> On Tue, Aug 18, 2026 at 11:17:47AM -0700, Junio C Hamano wrote:
>> Patrick Steinhardt <ps@pks.im> writes:
>> > @@ -618,8 +619,11 @@ int fill_midx_entry(struct multi_pack_index *m,
>> > return 0;
>> >
>> > if (oidset_size(&p->bad_objects) &&
>> > - oidset_contains(&p->bad_objects, oid))
>> > + oidset_contains(&p->bad_objects, oid)) {
>> > + if (bad_pack && !*bad_pack)
>> > + *bad_pack = p;
>> > return 0;
>> > + }
>>
>> Hmph, so the idea is that if you have even one bad thing, you are
>> marked as bad, because who knows what other parts of you are broken?
>
> No, not quite. We don't mark the whole pack itself as bad, we only mark
> the objects that's contained in there as bad. The only reason why we
> also bubble up the pack is so that we can provide a better error message
> in a subsequent commit, where we can then tell the user which pack it
> was specifically that contains the bad commit.
>
> That's by itself not visible in this commit yet, but I do mention it as
> part of the commit message.
>
> PatrickOK.
This is a tangent but the argument heavily relies on the invariant that a single pack can contain one object at most once. Once a corrupt pack that has copies of the same object duplicated in it comes into the picture, the error message has to say which copy is bad.