]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit-graph: propagate topo_levels slab to all chain layers
authorKristofer Karlsson <krka@spotify.com>
Thu, 9 Jul 2026 15:03:01 +0000 (15:03 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 9 Jul 2026 17:29:23 +0000 (10:29 -0700)
The topo_levels slab is only propagated to the topmost graph
layer instead of all layers in the chain.  Commits from lower
layers appear to have no generation numbers, so the DFS
re-walks the entire ancestry.

Fix by making topo_levels visible to all layers, not just
the first one.

Signed-off-by: Kristofer Karlsson <krka@spotify.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-graph.c
t/t5324-split-commit-graph.sh

index 702ba9731b0ed7c2e680dd424f6d5f5e71084c55..a0bca248ac9ceef8d86a8d6f717f4f174e93ca1f 100644 (file)
@@ -2610,7 +2610,7 @@ int write_commit_graph(struct odb_source *source,
 
        g = prepare_commit_graph(ctx.r);
        for (struct commit_graph *chain = g; chain; chain = chain->base_graph)
-               g->topo_levels = &topo_levels;
+               chain->topo_levels = &topo_levels;
 
        if (flags & COMMIT_GRAPH_WRITE_BLOOM_FILTERS)
                ctx.changed_paths = 1;
index b41331e3dd930c152e099ed566591bde960d6865..9e5ab7dbd07553d9b08afd646196c02d3892900c 100755 (executable)
@@ -718,7 +718,7 @@ test_expect_success 'write generation data chunk when commit-graph chain is repl
        )
 '
 
-test_expect_failure 'incremental write reads topo levels from all layers' '
+test_expect_success 'incremental write reads topo levels from all layers' '
        git init topo-from-lower &&
        (
                cd topo-from-lower &&