Diff options
Diffstat (limited to 'tests')
| -rwxr-xr-x | 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 "<div class=.commit-subject.>octopus<" tmp && + test $(grep -c "<th scope=.row.>parent</th>" tmp) = 3 && + test_grep ! "cgit-panel" tmp && + test_grep ! "<table class=.diffstat.>" tmp && + cgit_ok_url "foo/commit&h=twofold" >tmp && + test $(grep -c "<th scope=.row.>parent</th>" tmp) = 2 && + test_grep "cgit-panel" tmp && + test_grep "<table class=.diffstat.>" tmp ' test_done |
