From: Derrick Stolee Date: Thu, 24 Oct 2019 13:40:41 +0000 (+0000) Subject: t5510-fetch.sh: demonstrate fetch.writeCommitGraph bug X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e88aab917e0dc3e99af8fb0f3ecbef66ac3e49b6;p=git 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 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 for commit 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 Helped-by: Johannes Schindelin Helped-by: Szeder Gábor Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 91ede622f0..404e90013a 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -583,6 +583,22 @@ test_expect_success 'fetch.writeCommitGraph' ' ) ' +test_expect_failure 'fetch.writeCommitGraph with submodules' ' + git clone dups super && + ( + cd super && + git submodule add "file://$TRASH_DIRECTORY/three" && + git commit -m "add submodule" + ) && + git clone "super" super-clone && + ( + cd super-clone && + rm -rf .git/objects/info && + git -c fetch.writeCommitGraph=true fetch origin && + test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain + ) +' + # configured prune tests set_config_tristate () {