From cec2d9403e5b70b5fd43937f34cc0a7b096e567c Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 12:43:47 -1000 Subject: Check the octopus merge draws no diff The octopus took its first parent's tree, so its diff would have been empty whether drawn or not, and only the missing options were checked, with nothing to show the right page rendered. A merge of two parents, the other side of the limit, had no test. --- tests/t0106-commit.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/t0106-commit.sh b/tests/t0106-commit.sh index 5ca89b0..26ce38f 100755 --- a/tests/t0106-commit.sh +++ b/tests/t0106-commit.sh @@ -71,16 +71,28 @@ test_expect_success 'a message that is not UTF-8 has its stray bytes replaced' ' test_grep ! "caf$(printf "\351")" tmp ' -test_expect_success 'an octopus merge, which draws no diff, offers no diff options' ' +# The diff is taken against the first parent alone, which says little about +# a merge of three branches or more, so such a merge draws none and offers +# no diff options. A merge of two still draws its diff. Both merges take a +# tree their first parent lacks a file of, so a diff would have a row. +test_expect_success 'an octopus merge draws no diff and offers no diff options' ' ( cd repos/foo && - cid=$(git commit-tree -p HEAD -p HEAD~1 -p HEAD~2 -m octopus HEAD^{tree}) && - git update-ref refs/heads/octopus "$cid" + tree=$(git rev-parse HEAD~1^{tree}) && + cid=$(git commit-tree -p HEAD -p HEAD~1 -p HEAD~2 -m octopus $tree) && + git update-ref refs/heads/octopus "$cid" && + cid=$(git commit-tree -p HEAD -p HEAD~2 -m twofold $tree) && + git update-ref refs/heads/twofold "$cid" ) && - cgit_url "foo/commit&h=octopus" >tmp && - ! grep "cgit-panel" tmp && - cgit_url "foo/commit" >tmp && - grep "cgit-panel" tmp + cgit_ok_url "foo/commit&h=octopus" >tmp && + test_grep "
octopus<" tmp && + test $(grep -c "parent" tmp) = 3 && + test_grep ! "cgit-panel" tmp && + test_grep ! "" tmp && + cgit_ok_url "foo/commit&h=twofold" >tmp && + test $(grep -c "" tmp) = 2 && + test_grep "cgit-panel" tmp && + test_grep "
parent
" tmp ' test_done -- cgit 2.12.1