Re: [PATCH 2/7] commit-graph: read `OIDL` chunk with `pair_chunk_expect()`
- From
Jeff King <peff@peff.net>
- Date
- Nov 10, 2023, 22:10 UTC
- Message-ID
- <20231110221041.GK2758295@coredump.intra.peff.net>
- In-Reply-To
- <5b3c0b99f8052733bb714122582ab229556c94ef.1699569246.git.me@ttaylorr.com>
On Thu, Nov 09, 2023 at 05:34:14PM -0500, Taylor Blau wrote:
Show 11 quoted lines
> @@ -435,8 +425,10 @@ struct commit_graph *parse_commit_graph(struct repo_settings *s,
> error(_("commit-graph required OID fanout chunk missing or corrupted"));
> goto free_and_return;
> }
> - if (read_chunk(cf, GRAPH_CHUNKID_OIDLOOKUP, graph_read_oid_lookup, graph)) {
> - error(_("commit-graph required OID lookup chunk missing or corrupted"));
> + if (pair_chunk_expect(cf, GRAPH_CHUNKID_OIDLOOKUP,
> + &graph->chunk_oid_lookup, graph->hash_len,
> + graph->num_commits)) {
> + error(_("commit-graph OID lookup chunk is the wrong size"));
> goto free_and_return;I know the original message was vague, but I think the new one is actively misleading in the case of a missing chunk. We'll say "wrong size", but it was not present at all!
-Peff