Re: [PATCH v2 4/7] commit-graph: expose function to validate a commit graph chain
On 11/20/26 17:52, Patrick Steinhardt wrote:
Show 25 quoted lines
> diff --git a/commit-graph.c b/commit-graph.c
> index 08a151af29a..e48d8fc0a78 100644
> --- a/commit-graph.c
> +++ b/commit-graph.c
> @@ -574,6 +574,12 @@ static void validate_mixed_bloom_settings(struct commit_graph *g)
> }
> }
> > +void commit_graph_validate_chain(struct commit_graph *g)
> +{
> + validate_mixed_generation_chain(g);
> + validate_mixed_bloom_settings(g);
> +}
> +
> int commit_graph_link_base(struct commit_graph *g,
> struct commit_graph *base)
> {
> @@ -701,8 +707,7 @@ struct commit_graph *load_commit_graph_chain_fd_st(struct object_database *odb,
> }
> }
> > - validate_mixed_generation_chain(graph_chain);
> - validate_mixed_bloom_settings(graph_chain);
> + commit_graph_validate_chain(graph_chain);
> > fclose(fp);
> strbuf_release(&line);
>The change itself is straight-forward and neat.
diff --git a/commit-graph.h b/commit-graph.h
Show 13 quoted lines
> index 8660c7fe698..dc4f6194c72 100644
> --- a/commit-graph.h
> +++ b/commit-graph.h
> @@ -134,6 +134,13 @@ struct commit_graph *load_commit_graph_chain_fd_st(struct object_database *odb,
> */
> int commit_graph_link_base(struct commit_graph *g,
> struct commit_graph *base);
> +
> +/*
> + * Validate the chain of commit graph layers to ensure that all layers are
> + * compatible with one another. This may disable generation data and Bloom
> + * filters in case they aren't.
> + */
I just wonder if we could make potentially rephrase this comment as follows to make it more useful?
/*
* Reconcile the settings of a linked commit-graph chain, where `g` is
* its tip layer. Must be called after all layers have been linked.
*
* If any layer lacks generation data, generation data is disabled for
* all layers. Bloom filters are compared against the settings of the
* top-most layer that has them; lower layers with incompatible
* settings have their filters dropped, with a warning.
*/
> +void commit_graph_validate_chain(struct commit_graph *g);
In the same spirit, I wonder if commit_graph_reconcile_chain might be a better name for this one?
--
Sivaraam