Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Add the shared config writers and cgit_rc
The helpers are named by kind. cgitrc_repo and cgitrc_copy write the config file named first, and cgit_url, cgit_query and cgit_rc run cgit, each named after what it is handed first. A repository copies its defaults from the globals read before its repo.url, so cgitrc_repo places every setting itself, and a global can no longer land where it silently stops applying. The t00xx and t01xx files move to them here.
Diffstat (limited to 'tests/t0103-log.sh')
-rwxr-xr-xtests/t0103-log.sh28
1 file changed, 8 insertions, 20 deletions
diff --git a/tests/t0103-log.sh b/tests/t0103-log.sh
index 927c814..b789ca4 100755
--- a/tests/t0103-log.sh
+++ b/tests/t0103-log.sh
@@ -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&amp;follow=1.>\[next\]" tmp
@@ -97,7 +90,7 @@ test_expect_success 'a cut subject keeps whole characters' '
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 &&
+ cgit_rc subjectrc "url=foo/log/" >tmp &&
grep ">日本語の説\.\.\.</a>" tmp
'
@@ -106,7 +99,7 @@ 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 &&
+ cgit_rc graphrc "url=foo/log/" >tmp &&
grep "class=.commitgraph." tmp &&
grep "<th scope=.col. aria-label=.Graph.></th>" tmp
'
@@ -118,7 +111,7 @@ test_expect_success 'a followed log heads its age column with the graph on' '
echo "enable-commit-graph=1" &&
cat folrc
} >folgraphrc &&
- CGIT_CONFIG="$PWD/folgraphrc" QUERY_STRING="url=fol/log/b.txt&follow=1" cgit >tmp &&
+ 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
'
@@ -139,13 +132,8 @@ test_expect_success 'a walk that cannot start answers one error page' '
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-) &&
- {
- echo "virtual-root=/" &&
- echo "cache-size=0" &&
- echo "repo.url=gap" &&
- echo "repo.path=$PWD/gap/.git"
- } >gaprc &&
- CGIT_CONFIG="$PWD/gaprc" QUERY_STRING="url=gap/log/&qt=range&q=$old..master" cgit >tmp 2>err &&
+ 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