From 91d595eb821345fd41a8065f5ed1c121929da441 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 16:28:42 -1000 Subject: 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. --- tests/t0303-robustness.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests') 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 "
Blob is binary
" tmp && + test_grep ! "" tmp && + cgit_ok binblamerc "url=binblame/tree/bin.dat" >tmp && + test_grep "
blob: " tmp && + test_grep ! "href=./binblame/blame/" tmp && + cgit_ok binblamerc "url=binblame/tree/file-1" >tmp && + test_grep "(blame)" tmp +' + test_done -- cgit 2.12.1