diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
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.
Diffstat (limited to 'tests/t0108-rawdiff.sh')
-rwxr-xr-xtests/t0108-rawdiff.sh9
1 file changed, 9 insertions, 0 deletions
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 >tmp_ &&
+ cmp tmp_ tmp2 &&
+ grep "file-4" tmp_ &&
+ ! grep "file-5" tmp_
+'
+
test_done