Diff options
Diffstat (limited to 'tests/t0107-diff.sh')
-rwxr-xr-xtests/t0107-diff.sh10
1 file changed, 10 insertions, 0 deletions
diff --git a/tests/t0107-diff.sh b/tests/t0107-diff.sh
index f058246..96e37f5 100755
--- a/tests/t0107-diff.sh
+++ b/tests/t0107-diff.sh
@@ -22,6 +22,16 @@ test_expect_success 'find added line' '
grep "<div class=.add.>+5</div>" tmp
'
+# A revision that names no commit is quoted the way the request wrote it, as
+# the commit and patch pages quote it, on either side of the diff.
+test_expect_success 'a tree on either side is named as the request gave it' '
+ tree=$(git -C repos/foo rev-parse --short HEAD^{tree}) &&
+ cgit_query "url=foo/diff/&id=$tree" >tmp &&
+ grep "<div class=.error.>Not a commit: $tree</div>" tmp &&
+ cgit_query "url=foo/diff/&id2=$tree" >tmp &&
+ grep "<div class=.error.>Not a commit: $tree</div>" tmp
+'
+
# git writes a hunk length only when the hunk spans more than one line, so the
# header for a single line reads "@@ -1 +1 @@" with no comma in it. Requiring
# that comma left those hunks numbered from zero, which dropped the line