Diff options
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0104-tree.sh | 29 |
1 file changed, 29 insertions, 0 deletions
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index 490abb3..ca29bdc 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -190,6 +190,17 @@ test_expect_success 'only a link target inside the tree is linked' ' ! grep "href=./links/tree/etc/passwd" tmp ' +# Blame takes a regular file alone, so a symlink is not offered it. +test_expect_success 'a symlink is not offered blame' ' + cgitrc_repo linksblamerc links enable-blame=1 && + cgit_rc linksblamerc "url=links/tree/" >tmp && + grep "href=./links/blame/target.txt.>blame</a>" tmp && + ! grep "href=./links/blame/rel.>blame</a>" tmp && + cgit_rc linksblamerc "url=links/tree/rel" >tmp && + grep "<div class=.blob-header.>" tmp && + ! grep ">blame</a>" tmp +' + # A row follows a chain of single directories for a set number of levels and # stops on the last one it links, with no separator left hanging after it. test_expect_success 'a long directory chain ends on a link' ' @@ -265,4 +276,22 @@ test_expect_success 'a large binary is dumped only in part' ' grep "<div class=.truncated.>Only the first 64 KB of this file are shown. <a href=./bin/plain/big.bin.>View the whole file</a>.</div>" tmp ' +# The blame page refuses a file git counts as binary and one past +# max-blob-size, so a listing offers blame for neither. +test_expect_success 'a listing offers blame only where it works' ' + ( + cd repos/bin && + echo hello >small.txt && + test_seq 1 2000 >large.txt && + git add small.txt large.txt && + git commit -m "text files" + ) && + cgitrc_repo binblamerc bin enable-blame=1 max-blob-size=4 && + cgit_rc binblamerc "url=bin/tree/" >tmp && + grep "href=./bin/blame/small.txt.>blame</a>" tmp && + ! grep "href=./bin/blame/large.txt.>blame</a>" tmp && + ! grep "href=./bin/blame/blob.bin.>blame</a>" tmp && + ! grep "href=./bin/blame/big.bin.>blame</a>" tmp +' + test_done |
