From: Travor Liu Date: Wed, 15 Jul 2026 09:11:30 GMT Subject: [PATCH 2/2] t9502: test gitweb index hash formatting with modes Message-ID: In-Reply-To: From: Travor Liu gitweb should shorten and link the object IDs in commitdiff index lines even when Git includes the trailing file mode: index .. 100644 Add coverage for that common form by rendering a commitdiff for a regular file modification. Check that the visible index line contains linked short blob IDs followed by the mode and file-type annotation, and that the full unlinked form is not emitted. Signed-off-by: Travor Liu --- t/t9502-gitweb-standalone-parse-output.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/t/t9502-gitweb-standalone-parse-output.sh b/t/t9502-gitweb-standalone-parse-output.sh index 81d5625..7f37e26 100755 --- a/t/t9502-gitweb-standalone-parse-output.sh +++ b/t/t9502-gitweb-standalone-parse-output.sh @@ -115,6 +115,20 @@ test_expect_success 'snapshot: hierarchical branch name (xx/test)' ' ' test_debug 'cat gitweb.headers' +test_expect_success 'commitdiff: index line shortens hashes with mode' ' + old_blob=$(git rev-parse HEAD:foo) && + old_short=$(git rev-parse --short=7 HEAD:foo) && + echo changed >foo && + git commit -am "change foo" && + new_blob=$(git rev-parse HEAD:foo) && + new_short=$(git rev-parse --short=7 HEAD:foo) && + gitweb_run "p=.git;a=commitdiff;h=HEAD" && + grep ">${old_short}\\.\\.]*>${new_short} 100644" \ + gitweb.body >index_line && + grep " (file)" index_line && + ! grep "index ${old_blob}\\.\\.${new_blob} 100644" gitweb.body +' + # ---------------------------------------------------------------------- # forks of projects -- 2.52.0