Re: [PATCH 6/8] midx: read `OIDF` chunk with `pair_chunk_expect()`
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 13, 2023, 21:04 UTC
- Message-ID
- <xmqqmswmxmhp.fsf@gitster.g>
- In-Reply-To
- <b39203b32c24772d5d8a257c4f647b7d9bd92d53.1697225110.git.me@ttaylorr.com>
Taylor Blau <me@ttaylorr.com> writes:
Show 6 quoted lines
> + if (pair_chunk_expect(cf, MIDX_CHUNKID_OIDFANOUT,
> + (const unsigned char **)&m->chunk_oid_fanout,
> + 256 * sizeof(uint32_t))) {
> + error(_("multi-pack-index OID fanout is of the wrong size"));
> die(_("multi-pack-index required OID fanout chunk missing or corrupted"));
> + }This is not a new problem, but when laid out this way, the doubled messages look a bit suboptimal.
Together with reporting the actual and expected byte counts and doing so consistenly I alluded to in a separate message, cleaning these up should probably be left outside of the topic, I suspect.
> + m->num_objects = ntohl(m->chunk_oid_fanout[255]);
> if (read_chunk(cf, MIDX_CHUNKID_OIDLOOKUP, midx_read_oid_lookup, m))
> die(_("multi-pack-index required OID lookup chunk missing or corrupted"));
> if (read_chunk(cf, MIDX_CHUNKID_OBJECTOFFSETS, midx_read_object_offsets, m))