Re: [PATCH 5/5] commit-graph: prepare commit graph
From: Taylor Blau <hidden>
Date: 2021-02-01 18:26:31
On Mon, Feb 01, 2021 at 05:15:07PM +0000, Derrick Stolee via GitGitGadget wrote:
From: Derrick Stolee <redacted> Before checking if the repository has a commit-graph loaded, be sure to run prepare_commit_graph(). This is necessary because without this instance we would not initialize the topo_levels slab for each of the struct commit_graphs in the chain before we start to parse the commits. This leads to possibly recomputing the topological levels for commits in lower layers even when we are adding a small number of commits on top.
I think that the situation arises as follows:
- Prior to this patch, we didn't always prepare the commit-graph, so
the topo_levels slab wasn't initialized either.
- Then we try and compute the topo levels for new commits (which are
likely to be decendants of older ones that are in commit-graphs and
have their topo-levels already computed).
- But in the course of computing topo-levels for the new commits, we
have to recur on their ancestors, which *look* like they have
uncomputed topo levels.
That all makes sense, but it may be worth cutting and pasting what I
wrote into your patch to make it clearer.
By properly initializing the topo_slab, we fix the previously broken case of a split commit graph where a base layer has the generation_data_overflow chunk.
Makes sense.
quoted hunk ↗ jump to hunk
-test_expect_failure 'lower layers have overflow chunk' ' +test_expect_success 'lower layers have overflow chunk' ' cd "$TRASH_DIRECTORY/full" && UNIX_EPOCH_ZERO="@0 +0000" && FUTURE_DATE="@2147483646 +0000" &&
Terrific :-). Thanks, Taylor