The `OIDL` chunk can benefit from the new chunk-format API function described in the previous commit. Convert it to `pair_chunk_expect()` accordingly. Signed-off-by: Taylor Blau <me@xxxxxxxxxxxx> --- midx.c | 16 ++-------------- t/t5319-multi-pack-index.sh | 1 - 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/midx.c b/midx.c index 1d14661dad..66f34ed1a3 100644 --- a/midx.c +++ b/midx.c @@ -86,19 +86,6 @@ static int midx_read_oid_fanout(const unsigned char *chunk_start, return 0; } -static int midx_read_oid_lookup(const unsigned char *chunk_start, - size_t chunk_size, void *data) -{ - struct multi_pack_index *m = data; - m->chunk_oid_lookup = chunk_start; - - if (chunk_size != st_mult(m->hash_len, m->num_objects)) { - error(_("multi-pack-index OID lookup chunk is the wrong size")); - return 1; - } - return 0; -} - static int midx_read_object_offsets(const unsigned char *chunk_start, size_t chunk_size, void *data) { @@ -186,7 +173,8 @@ struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local die(_("multi-pack-index required pack-name chunk missing or corrupted")); if (read_chunk(cf, MIDX_CHUNKID_OIDFANOUT, midx_read_oid_fanout, m)) die(_("multi-pack-index required OID fanout chunk missing or corrupted")); - if (read_chunk(cf, MIDX_CHUNKID_OIDLOOKUP, midx_read_oid_lookup, m)) + if (pair_chunk_expect(cf, MIDX_CHUNKID_OIDLOOKUP, &m->chunk_oid_lookup, + m->hash_len, m->num_objects)) die(_("multi-pack-index required OID lookup chunk missing or corrupted")); if (read_chunk(cf, MIDX_CHUNKID_OBJECTOFFSETS, midx_read_object_offsets, m)) die(_("multi-pack-index required object offsets chunk missing or corrupted")); diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh index 313496c0cf..2d68616c59 100755 --- a/t/t5319-multi-pack-index.sh +++ b/t/t5319-multi-pack-index.sh @@ -1077,7 +1077,6 @@ test_expect_success 'reader notices too-small oid lookup chunk' ' corrupt_chunk OIDL clear 00000000 && test_must_fail git log 2>err && cat >expect <<-\EOF && - error: multi-pack-index OID lookup chunk is the wrong size fatal: multi-pack-index required OID lookup chunk missing or corrupted EOF test_cmp expect err -- 2.43.0.rc0.39.g44bd344727