Skip to content

Commit a09c130

Browse files
derrickstoleegitster
authored andcommitted
commit-graph: test --split across alternate without --split
We allow sharing commit-graph files across alternates. When we are writing a split commit-graph, we allow adding tip graph files that are not in the alternate, but include commits from our local repo. However, if our alternate is not using the split commit-graph format, its file is at .git/objects/info/commit-graph and we are trying to write files in .git/objects/info/commit-graphs/graph-{hash}.graph. We already have logic to ensure we do not merge across alternate boundaries, but we also cannot have a commit-graph chain to our alternate if uses the old filename structure. Create a test that verifies we create a new split commit-graph with only one level and we do not modify the existing commit-graph in the alternate. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e2017c4 commit a09c130

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

t/t5324-split-commit-graph.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,19 @@ test_expect_success 'add octopus merge' '
301301

302302
graph_git_behavior 'graph exists' merge/octopus commits/12
303303

304+
test_expect_success 'split across alternate where alternate is not split' '
305+
git commit-graph write --reachable &&
306+
test_path_is_file .git/objects/info/commit-graph &&
307+
cp .git/objects/info/commit-graph . &&
308+
git clone --no-hardlinks . alt-split &&
309+
(
310+
cd alt-split &&
311+
echo "$(pwd)"/../.git/objects >.git/objects/info/alternates &&
312+
test_commit 18 &&
313+
git commit-graph write --reachable --split &&
314+
test_line_count = 1 $graphdir/commit-graph-chain
315+
) &&
316+
test_cmp commit-graph .git/objects/info/commit-graph
317+
'
318+
304319
test_done

0 commit comments

Comments
 (0)