From 702fd5d5d7a3c981856b711d785c44f65f8b9da6 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 30 Oct 2026 22:51:19 -0700 Subject: Look up a request's commit in one place The diff page now names a revision that is no commit the way the request wrote it, as the other pages already did, rather than as the full id it resolved to. The helpers sit beside the error page in ui-shared.c, since shared.c prints nothing. --- tests/t0107-diff.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/t0107-diff.sh') 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 "
+5
" 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 "
Not a commit: $tree
" tmp && + cgit_query "url=foo/diff/&id2=$tree" >tmp && + grep "
Not a commit: $tree
" 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 -- cgit 2.12.1