From c08645b353514fe14dbd62cf52afd49d0e88146b Mon Sep 17 00:00:00 2001 From: Taylor Blau Date: Mon, 20 Mar 2023 11:26:52 +0000 Subject: commit-graph: introduce `ensure_generations_valid()` Use the just-introduced compute_reachable_generation_numbers_1() to implement a function which dynamically computes topological levels (or corrected commit dates) for out-of-graph commits. This will be useful for the ahead-behind algorithm we are about to introduce, which needs accurate topological levels on _all_ commits reachable from the tips in order to avoid over-counting. Co-authored-by: Derrick Stolee Signed-off-by: Taylor Blau Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- commit-graph.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'commit-graph.h') diff --git a/commit-graph.h b/commit-graph.h index 37faee6b66..73e182ab2d 100644 --- a/commit-graph.h +++ b/commit-graph.h @@ -190,4 +190,12 @@ struct commit_graph_data { */ timestamp_t commit_graph_generation(const struct commit *); uint32_t commit_graph_position(const struct commit *); + +/* + * After this method, all commits reachable from those in the given + * list will have non-zero, non-infinite generation numbers. + */ +void ensure_generations_valid(struct repository *r, + struct commit **commits, size_t nr); + #endif -- cgit v1.2.3