From 6750cf51381e84abb7ca0aede6639d51781ae4de Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 18:04:42 -1000 Subject: Test the clamp on the diff context --- tests/t0204-limits.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/t0204-limits.sh b/tests/t0204-limits.sh index ab68937..fc61b5c 100755 --- a/tests/t0204-limits.sh +++ b/tests/t0204-limits.sh @@ -270,4 +270,24 @@ test_expect_success 'patch and rawdiff show an oversized blob as binary' ' done ' +# The diff options offer up to 40 lines of context, and context lines are +# not counted against max-diff-lines, so a request asking for more is held +# at 40. One asking for less than none falls back to the default. +test_expect_success 'the context a request asks for is clamped' ' + test_create_repo repos/context && + test_seq 1 100 >repos/context/f && + git -C repos/context add f && + git -C repos/context commit -q -m one && + test_seq 1 100 | sed "s/^50$/fifty/" >repos/context/f && + git -C repos/context commit -q -a -m two && + cgitrc_repo contextrc context && + cgit_ok contextrc "url=context/commit/&context=100000" >tmp && + test_grep "class=.hunk.>@@ -10,81 +10,81 @@" tmp && + test_grep "