Re: [PATCH 5/8] commit-graph: read `BIDX` chunk with `pair_chunk_expect()`
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Oct 13, 2023, 19:49 UTC
- Message-ID
- <ZSmfYtkOjqwqtbzz@nand.local>
- In-Reply-To
- <45cac29403e63483951f7766c6da3c022c68d9f0.1697225110.git.me@ttaylorr.com>
On Fri, Oct 13, 2023 at 03:25:30PM -0400, Taylor Blau wrote:
Show 7 quoted lines
> Perform an identical conversion as in previous commits to read the BIDX > chunk. > > Signed-off-by: Taylor Blau <me@ttaylorr.com> > --- > commit-graph.c | 18 ++++-------------- > 1 file changed, 4 insertions(+), 14 deletions(-)
Oops. This fails t4216 because it changes the warning() message, which I thought I excluded from this patch :-<.
Here is a replacement that passes the test. I can reroll the entire "series" if we decide that this is a worthwhile direction to go in:
--- 8< ---
Subject: [PATCH] commit-graph: read `BIDX` chunk with `pair_chunk_expect()`
Perform an identical conversion as in previous commits to read the BIDX chunk.
Signed-off-by: Taylor Blau <me@ttaylorr.com> --- commit-graph.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/commit-graph.c b/commit-graph.c index 0fab99f5dd..66c2e628d8 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -330,18 +330,6 @@ static int graph_read_oid_lookup(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 != g->num_commits * 4) { - 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) { @@ -461,8 +449,10 @@ 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); + if (pair_chunk_expect(cf, GRAPH_CHUNKID_BLOOMINDEXES, + &graph->chunk_bloom_indexes, + st_mult(graph->num_commits, 4)) == -1) + warning(_("commit-graph changed-path index chunk is too small")); read_chunk(cf, GRAPH_CHUNKID_BLOOMDATA, graph_read_bloom_data, graph); } -- 2.38.0.16.g393fd4c6db