diff --git a/commit-graph.c b/commit-graph.c index b3c4de79b6..90fdee9256 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1636,7 +1636,7 @@ static void sort_and_scan_merged_commits(struct write_commit_graph_context *ctx) num_parents++; if (num_parents > 2) - ctx->num_extra_edges += num_parents - 2; + ctx->num_extra_edges += num_parents - 1; } } diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh index 03f45a1ed9..99f4ef4c19 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 '