Diff options
Diffstat (limited to '')
| -rwxr-xr-x | tests/t0103-log.sh | 57 |
1 file changed, 35 insertions, 22 deletions
diff --git a/tests/t0103-log.sh b/tests/t0103-log.sh index d7e745d..9796394 100755 --- a/tests/t0103-log.sh +++ b/tests/t0103-log.sh @@ -12,7 +12,7 @@ test_expect_success 'find commit 1' 'grep "commit 1" tmp' test_expect_success 'find commit 5' 'grep "commit 5" tmp' test_expect_success 'generate bar/log' 'cgit_url "bar/log" >tmp' -test_expect_success 'find commit 1' 'grep "commit 1" tmp' +test_expect_success 'find commit 1' 'grep ">commit 1<" tmp' test_expect_success 'find commit 50' 'grep "commit 50" tmp' # The switch button submits the select as h, so whatever head the request @@ -38,7 +38,7 @@ test_expect_success 'a branch head keeps its plain option' ' test_expect_success 'generate "with%20space/log?qt=grep&q=commit+1"' ' cgit_url "with+space/log&qt=grep&q=commit+1" >tmp ' -test_expect_success 'find commit 1' 'grep "commit 1" tmp' +test_expect_success 'find commit 1' 'grep ">commit 1<" tmp' test_expect_success 'find link with %20 in path' 'grep "/with%20space/log/?qt=grep" tmp' test_expect_success 'find link with + in arg' 'grep "/log/?qt=grep&q=commit+1" tmp' test_expect_success 'no links with space in path' '! grep "href=./with space/" tmp' @@ -68,24 +68,17 @@ test_expect_success 'set up a renamed file to follow' ' git commit -am "edit b $i" || return 1 done ) && - { - echo "virtual-root=/" && - echo "cache-size=0" && - echo "enable-follow-links=1" && - echo "max-commit-count=3" && - echo "repo.url=fol" && - echo "repo.path=$PWD/repos/fol/.git" - } >folrc + cgitrc_repo folrc fol enable-follow-links=1 max-commit-count=3 ' test_expect_success 'a followed log reaches the root commit' ' - CGIT_CONFIG="$PWD/folrc" QUERY_STRING="url=fol/log/b.txt&follow=1&ofs=6" cgit >tmp && + cgit_rc folrc "url=fol/log/b.txt&follow=1&ofs=6" >tmp && grep ">edit a 2<" tmp && grep ">create a<" tmp ' test_expect_success 'the pager of a followed log keeps the name followed' ' - CGIT_CONFIG="$PWD/folrc" QUERY_STRING="url=fol/log/b.txt&follow=1&ofs=3" cgit >tmp && + cgit_rc folrc "url=fol/log/b.txt&follow=1&ofs=3" >tmp && grep ">edit a 3<" tmp && grep "href=./fol/log/b.txt?follow=1.>\[prev\]" tmp && grep "href=./fol/log/b.txt?ofs=6&follow=1.>\[next\]" tmp @@ -93,24 +86,30 @@ test_expect_success 'the pager of a followed log keeps the name followed' ' test_expect_success 'a cut subject keeps whole characters' ' git -C repos/foo commit --allow-empty -m "日本語の説明文です日本語の説明文です" && - { - echo "max-message-length=20" && - sed "s/^cache-size=.*/cache-size=0/" cgitrc - } >subjectrc && - CGIT_CONFIG="$PWD/subjectrc" QUERY_STRING="url=foo/log/" cgit >tmp && + cgitrc_copy subjectrc max-message-length=20 && + cgit_rc subjectrc "url=foo/log/" >tmp && grep ">日本語の説\.\.\.</a>" tmp ' test_expect_success 'the log draws the commit graph when enabled' ' - { - echo "enable-commit-graph=1" && - sed "s/^cache-size=.*/cache-size=0/" cgitrc - } >graphrc && - CGIT_CONFIG="$PWD/graphrc" QUERY_STRING="url=foo/log/" cgit >tmp && + cgitrc_copy graphrc enable-commit-graph=1 && + cgit_rc graphrc "url=foo/log/" >tmp && grep "class=.commitgraph." tmp && grep "<th scope=.col. aria-label=.Graph.></th>" tmp ' +# A followed log is walked without the graph, so its first column holds the +# age whatever enable-commit-graph says. +test_expect_success 'a followed log heads its age column with the graph on' ' + { + echo "enable-commit-graph=1" && + cat folrc + } >folgraphrc && + cgit_rc folgraphrc "url=fol/log/b.txt&follow=1" >tmp && + grep "<th class=.left. scope=.col.>Age</th><th class=.left. scope=.col.>Commit message" tmp && + ! grep "aria-label=.Graph." tmp +' + # The search is literal, so text that is no valid regular expression still # finds the commit holding it. test_expect_success 'a search for brackets matches them literally' ' @@ -120,4 +119,18 @@ test_expect_success 'a search for brackets matches them literally' ' grep "fix \\[brackets\\] in docs" tmp ' +# A range is walked in full before the first row, so a missing parent fails +# the walk while the page can still answer with an error of its own. +test_expect_success 'a walk that cannot start answers one error page' ' + git clone -q repos/foo gap && + old=$(git -C gap rev-parse HEAD~4) && + parent=$(git -C gap rev-parse HEAD~2) && + rm gap/.git/objects/$(echo $parent | cut -c1-2)/$(echo $parent | cut -c3-) && + cgitrc_repo gaprc gap "repo.path=$PWD/gap/.git" && + cgit_rc gaprc "url=gap/log/&qt=range&q=$old..master" >tmp 2>err && + test $(grep -c "^Status:" tmp) = 1 && + grep "^Status: 500" tmp && + grep "Unable to read the history" tmp +' + test_done |
