From b9e3ea6a1b3a5fa9a2c2ec8cf9e15870261d9221 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 1 Nov 2026 15:27:07 -1000 Subject: Keep the range in a large diff's patch link The link named only id, so for a diff between two commits it led to a patch of the newer one alone, and without an id it lost the branch as well and led to the default branch's tip. --- tests/t0204-limits.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') diff --git a/tests/t0204-limits.sh b/tests/t0204-limits.sh index ecc33bf..9b0488c 100755 --- a/tests/t0204-limits.sh +++ b/tests/t0204-limits.sh @@ -135,6 +135,17 @@ test_expect_success 'the single-file page is not limited by max-diff-files' ' grep "class=.hunk." tmp ' +# The patch the notice links to has to hold the change the page compared, +# both ends of a range and a branch other than the default. +test_expect_success 'the stat only notice links the patch of the same change' ' + new=$(git -C repos/limits rev-parse HEAD) && + old=$(git -C repos/limits rev-parse HEAD~2) && + cgit_rc limitfilesrc "url=limits/diff/&id=$new&id2=$old" >tmp && + grep "href=./limits/patch/?id=$new&id2=$old.>patch link" tmp && + cgit_rc limitfilesrc "url=limits/diff/&h=branch-1" >tmp && + grep "href=./limits/patch/?h=branch-1.>patch link" tmp +' + # The diff views must not inflate a blob past max-blob-size merely to render # it, which is the same defence the tree and plain views make and is easy to # miss on this path. Such a file is reported as binary instead. -- cgit 2.12.1