Subject: Re: [PATCH 6/8] midx: read `OIDF` chunk with `pair_chunk_expect()`

From: Junio C Hamano <[email-masked]>
Date: Fri, 13 Oct 2023 14:04:34 -0700

Taylor Blau <[email-masked]> writes:

> +	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))