diff options
author | Taylor Blau <me@ttaylorr.com> | 2023-11-10 01:34:24 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-11-10 03:31:33 +0300 |
commit | 17e0f9a0ed8dbaf60db5362f8c4b74ce9b74ab1e (patch) | |
tree | b375d198b1410ec4b239b726378a246a5e10fbe2 /commit-graph.c | |
parent | 79a0810a1e306860651d550ce862989f62771afb (diff) |
commit-graph: read `BIDX` chunk with `pair_chunk_expect()`
The `BIDX` 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@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
-rw-r--r-- | commit-graph.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/commit-graph.c b/commit-graph.c index dfe261c39e..f89ffef128 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -299,18 +299,6 @@ static int graph_read_oid_fanout(const unsigned char *chunk_start, return 0; } -static int graph_read_bloom_index(const unsigned char *chunk_start, - size_t chunk_size, void *data) -{ - struct commit_graph *g = data; - if (chunk_size / 4 != g->num_commits) { - warning(_("commit-graph changed-path index chunk is too small")); - return -1; - } - g->chunk_bloom_indexes = chunk_start; - return 0; -} - static int graph_read_bloom_data(const unsigned char *chunk_start, size_t chunk_size, void *data) { @@ -437,8 +425,11 @@ struct commit_graph *parse_commit_graph(struct repo_settings *s, } if (s->commit_graph_read_changed_paths) { - read_chunk(cf, GRAPH_CHUNKID_BLOOMINDEXES, - graph_read_bloom_index, graph); + int res = pair_chunk_expect(cf, GRAPH_CHUNKID_BLOOMINDEXES, + &graph->chunk_bloom_indexes, + sizeof(uint32_t), graph->num_commits); + if (res && res != CHUNK_NOT_FOUND) + warning(_("commit-graph changed-path index chunk is too small")); read_chunk(cf, GRAPH_CHUNKID_BLOOMDATA, graph_read_bloom_data, graph); } |