Skip to content

Commit e88aab9

Browse files
derrickstoleegitster
authored andcommitted
t5510-fetch.sh: demonstrate fetch.writeCommitGraph bug
While dogfooding, Johannes found a bug in the fetch.writeCommitGraph config behavior. His example initially happened during a clone with --recurse-submodules, we found that this happens with the first fetch after cloning a repository that contains a submodule: $ git clone <url> test $ cd test $ git -c fetch.writeCommitGraph=true fetch origin Computing commit graph generation numbers: 100% (12/12), done. BUG: commit-graph.c:886: missing parent <hash1> for commit <hash2> Aborted (core dumped) In the repo I had cloned, there were really 60 commits to scan, but only 12 were in the list to write when calling compute_generation_numbers(). A commit in the list expects to see a parent, but that parent is not in the list. A follow-up will fix the bug, but first we create a test that demonstrates the problem. This test must be careful about an existing commit-graph file, since GIT_TEST_COMMIT_GRAPH=1 will cause the repo we are cloning to already have one. This then prevents the incremtnal commit-graph write during the first 'git fetch'. Helped-by: Jeff King <[email protected]> Helped-by: Johannes Schindelin <[email protected]> Helped-by: Szeder Gábor <[email protected]> Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 50f26bd commit e88aab9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

t/t5510-fetch.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,22 @@ test_expect_success 'fetch.writeCommitGraph' '
583583
)
584584
'
585585

586+
test_expect_failure 'fetch.writeCommitGraph with submodules' '
587+
git clone dups super &&
588+
(
589+
cd super &&
590+
git submodule add "file://$TRASH_DIRECTORY/three" &&
591+
git commit -m "add submodule"
592+
) &&
593+
git clone "super" super-clone &&
594+
(
595+
cd super-clone &&
596+
rm -rf .git/objects/info &&
597+
git -c fetch.writeCommitGraph=true fetch origin &&
598+
test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain
599+
)
600+
'
601+
586602
# configured prune tests
587603

588604
set_config_tristate () {

0 commit comments

Comments
 (0)