From b275e66df0ad3f000d1e0fa964c58b04711066e5 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Wed, 23 Sep 2026 19:13:47 -1000 Subject: Limit rawdiff to the requested path The diff and patch pages honour the path in the url, which the parameter table documents for every page, but rawdiff never handed it to git and answered with the whole diff. --- tests/t0108-rawdiff.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/t0108-rawdiff.sh b/tests/t0108-rawdiff.sh index 7753bdb..f68628a 100755 --- a/tests/t0108-rawdiff.sh +++ b/tests/t0108-rawdiff.sh @@ -46,4 +46,13 @@ test_expect_success 'compare with output of git-diff(1)' ' cmp tmp_ tmp2 ' +test_expect_success 'a path limits the diff to that file' ' + cgit_query "url=foo/rawdiff/file-4&id=$id&id2=$id2" >tmp && + git --git-dir="$PWD/repos/foo/.git" diff HEAD~3..HEAD -- file-4 >tmp2 && + strip_headers tmp_ && + cmp tmp_ tmp2 && + grep "file-4" tmp_ && + ! grep "file-5" tmp_ +' + test_done -- cgit 2.12.1