Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Read the description file without repo.desc
Only a scanned repository fell back to its description file, so one
listed in cgitrc without repo.desc showed "[no description]" however
its file read. repo.desc may follow repo.path, so the file is read
where a page shows the description, which also spares every other
request the reads.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/setup.sh | 3 | |
| -rwxr-xr-x | tests/t0101-index.sh | 26 |
2 files changed, 28 insertions, 1 deletion
diff --git a/tests/setup.sh b/tests/setup.sh index 92451b7..421e043 100755 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -130,7 +130,8 @@ clone-url=git://example.org/\$CGIT_REPO_URL.git repo.url=foo repo.path=$PWD/repos/foo/.git -# No repo.desc here, so the [no description] default gets exercised. +# No repo.desc here, and the description file holds git's placeholder, so +# the [no description] default gets exercised. repo.url=bar repo.path=$PWD/repos/bar/.git diff --git a/tests/t0101-index.sh b/tests/t0101-index.sh index 9b02a18..0953b8d 100755 --- a/tests/t0101-index.sh +++ b/tests/t0101-index.sh @@ -93,4 +93,30 @@ test_expect_success 'a scan lists repositories in path order' ' test_cmp expect order ' +# A repository listed without repo.desc shows the first line of its own +# description file, as a scanned one does. A repo.desc after the repo.path +# still wins, and git's placeholder still reads as no description. +test_expect_success 'a repository without repo.desc reads its description file' ' + mkrepo repos/described 1 && + printf "told by the file\nsecond line\n" >repos/described/.git/description && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "repo.url=described" && + echo "repo.path=$PWD/repos/described/.git" && + echo "repo.url=overridden" && + echo "repo.path=$PWD/repos/described/.git" && + echo "repo.desc=from cgitrc" && + echo "repo.url=placeholder" && + echo "repo.path=$PWD/repos/foo/.git" + } >describedrc && + cgit_rc describedrc "url=" >tmp && + grep "href=./described/.>told by the file</a>" tmp && + grep "href=./overridden/.>from cgitrc</a>" tmp && + grep "href=./placeholder/.>\[no description\]</a>" tmp && + ! grep "second line" tmp && + cgit_rc describedrc "url=described/" >tmp && + grep "<meta name=.description. content=.told by the file.>" tmp +' + test_done |
