From de4c0aee367e0103040b1facaa596ef4f1273d49 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 09:01:14 -1000 Subject: Test a followed single-file diff against the cap Follow empties the prefix, and the cap has to come from the path asked for, as the source warns. Only the line cap can show that. The pairs are filtered before they are counted, so a single-file page counts one file whatever the cap, and a followed check under max-diff-files could never fail. --- tests/t0204-limits.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'tests/t0204-limits.sh') diff --git a/tests/t0204-limits.sh b/tests/t0204-limits.sh index 9b0488c..7361048 100755 --- a/tests/t0204-limits.sh +++ b/tests/t0204-limits.sh @@ -116,9 +116,24 @@ test_expect_success 'small file in the same commit still renders inline' ' ' test_expect_success 'the single-file diff page always renders in full' ' - cgit_rc limitrc "url=limits/diff/big.c" >tmp && - grep "class=.hunk." tmp && - ! grep "too large to be rendered inline" tmp + cgit_ok limitrc "url=limits/diff/big.c" >tmp && + test_grep "class=.hunk." tmp && + test_grep ! "too large to be rendered inline" tmp +' + +# Following renames empties the prefix so the diff machinery sees the whole +# commit, yet the page still shows the one file it names, so the cap has to +# come from the path asked for. The links keeping follow=1 show that the page +# took that path. +test_expect_success 'a followed single-file diff page renders in full' ' + { + echo "enable-follow-links=1" && + cat limitrc + } >followrc && + cgit_ok followrc "url=limits/diff/big.c&follow=1" >tmp && + test_grep "href=./limits/diff/big.c?follow=1." tmp && + test_grep "class=.hunk." tmp && + test_grep ! "too large to be rendered inline" tmp ' # max-diff-files counts the files in a commit rather than the lines in one, @@ -131,8 +146,8 @@ test_expect_success 'a commit changing too many files shows stat only' ' ' test_expect_success 'the single-file page is not limited by max-diff-files' ' - cgit_rc limitfilesrc "url=limits/diff/small.c" >tmp && - grep "class=.hunk." tmp + cgit_ok limitfilesrc "url=limits/diff/small.c" >tmp && + test_grep "class=.hunk." tmp ' # The patch the notice links to has to hold the change the page compared, -- cgit 2.12.1