Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Test blame on a binary file
t0104's binary fixture never turns blame on, so neither the blame
page's own refusal nor the missing link on the file's page had a test.
| -rwxr-xr-x | tests/t0303-robustness.sh | 21 |
1 file changed, 21 insertions, 0 deletions
diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index d511ac1..841a031 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -888,4 +888,25 @@ test_expect_success 'a crafted HEAD cannot date a repository from outside it' ' test_grep ! "data-ut=.946" tmp ' +# Blame works on text alone, so a binary file is offered no blame link from +# its own page, and a request that names one anyway is told why. +test_expect_success 'blame turns away a binary file' ' + mkrepo repos/binblame 1 && + ( + cd repos/binblame && + printf "a\000b\n" >bin.dat && + git add bin.dat && + git commit -q -m binary + ) && + cgitrc_repo binblamerc binblame repo.enable-blame=1 && + cgit_ok binblamerc "url=binblame/blame/bin.dat" >tmp && + test_grep "<div class=.error.>Blob is binary</div>" tmp && + test_grep ! "<table class=.blame blob.>" tmp && + cgit_ok binblamerc "url=binblame/tree/bin.dat" >tmp && + test_grep "<div class=.blob-header.>blob: " tmp && + test_grep ! "href=./binblame/blame/" tmp && + cgit_ok binblamerc "url=binblame/tree/file-1" >tmp && + test_grep "(<a href=./binblame/blame/file-1.>blame</a>)" tmp +' + test_done |
