summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2019-08-05 16:43:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-08-05 21:59:50 (GMT)
commita35bea40b674b21fbdb98d982e41c46d014ced83 (patch)
tree9bf2247236869d3f41bbd0b9a2df746fcc2ecf66 /t
parent7c20df84bd21ec0215358381844274fa10515017 (diff)
downloadgit-a35bea40b674b21fbdb98d982e41c46d014ced83.zip
git-a35bea40b674b21fbdb98d982e41c46d014ced83.tar.gz
git-a35bea40b674b21fbdb98d982e41c46d014ced83.tar.bz2
commit-graph: fix bug around octopus merges
In 1771be90 "commit-graph: merge commit-graph chains" (2019-06-18), the method sort_and_scan_merged_commits() was added to merge the commit lists of two commit-graph files in the incremental format. Unfortunately, there was an off-by-one error in that method around incrementing num_extra_edges, which leads to an incorrect offset for the base graph chunk. When we store an octopus merge in the commit-graph file, we store the first parent in the normal place, but use the second parent position to point into the "extra edges" chunk where the remaining parents exist. This means we should be adding "num_parents - 1" edges to this list, not "num_parents - 2". That is the basic error. The reason this was not caught in the test suite is more subtle. In 5324-split-commit-graph.sh, we test creating an octopus merge and adding it to the tip of a commit-graph chain, then verify the result. This _should_ have caught the problem, except that when we load the commit-graph files we were overly careful to not fail when the commit-graph chain does not match. This care was on purpose to avoid race conditions as one process reads the chain and another process modifies it. In such a case, the reading process outputs the following message to stderr: warning: commit-graph chain does not match These warnings are output in the test suite, but ignored. By checking the stderr of `git commit-graph verify` to include the expected progress output, it will now catch this error. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t5324-split-commit-graph.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh
index 03f45a1..99f4ef4 100755
--- a/t/t5324-split-commit-graph.sh
+++ b/t/t5324-split-commit-graph.sh
@@ -319,7 +319,9 @@ test_expect_success 'add octopus merge' '
git merge commits/3 commits/4 &&
git branch merge/octopus &&
git commit-graph write --reachable --split &&
- git commit-graph verify &&
+ git commit-graph verify 2>err &&
+ test_line_count = 3 err &&
+ test_i18ngrep ! warning err &&
test_line_count = 3 $graphdir/commit-graph-chain
'