Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Test plain on a symlink and a submodule entry
| -rwxr-xr-x | tests/t0105-plain.sh | 24 |
1 file changed, 24 insertions, 0 deletions
diff --git a/tests/t0105-plain.sh b/tests/t0105-plain.sh index 63ab661..5364a0e 100755 --- a/tests/t0105-plain.sh +++ b/tests/t0105-plain.sh @@ -73,6 +73,30 @@ test_expect_success 'a folder listing links its entries and its parent' ' test_grep "<li><a href=./folders/plain/dir/sub/b.txt.>b.txt</a></li>" tmp ' +# A symlink is answered with its target as text. A submodule's commit lives +# in another repository, so its entry names that commit rather than linking +# a path here. +test_expect_success 'plain serves a link target and lists a submodule' ' + mkrepo repos/plainmod 1 && + ( + cd repos/plainmod && + sub=$(git rev-parse HEAD) && + git update-index --add --cacheinfo 160000,$sub,sub && + link=$(printf file-1 | git hash-object -w --stdin) && + git update-index --add --cacheinfo 120000,$link,link && + git commit -m "link and submodule" + ) && + cgitrc_repo plainmodrc plainmod && + cgit_ok plainmodrc "url=plainmod/plain/link" >tmp && + strip_headers <tmp >body && + printf file-1 >expect && + test_cmp expect body && + sub=$(git -C repos/plainmod rev-parse HEAD~1) && + cgit_ok plainmodrc "url=plainmod/plain/" >tmp && + test_grep "<li><span>sub</span> @ <span class=.ls-mod-hash. title=.$sub.>" tmp && + test_grep ! "href=./plainmod/plain/sub" tmp +' + test_expect_success 'a blob whose bytes look binary is served as octet-stream' ' ( cd repos/foo && |
