From 22773596fe2e472bb9a41894c7b09b656890a056 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 1 Oct 2026 16:20:14 -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 v2.8.0