From bf9aefb7a6cf7c799c2003459a69dbb5b3770e8a Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 12:59:31 -1000 Subject: Test stray bytes in a tag's tagger and message --- tests/t0113-tag.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/t0113-tag.sh') diff --git a/tests/t0113-tag.sh b/tests/t0113-tag.sh index b6fd980..209d039 100755 --- a/tests/t0113-tag.sh +++ b/tests/t0113-tag.sh @@ -106,6 +106,27 @@ test_expect_success 'a signed tag shows its signature in the message' ' grep "
Notes.-----BEGIN PGP SIGNATURE-----iQEzBAABCAAdFiEE-----END PGP SIGNATURE-----
" flat ' +# A tag carries no encoding header, so its text is taken as UTF-8, and a byte +# that is not has a question mark put in its place on a page declared UTF-8. +test_expect_success 'a tag has its stray bytes replaced' ' + ( + cd repos/foo && + { + echo "object $(git rev-parse HEAD)" && + echo "type commit" && + echo "tag latin" && + printf "tagger C\\351 Mitter 1700000000 +0000\\n" && + echo && + printf "caf\\351 release\\n" + } >latin-tag && + git update-ref refs/tags/latin $(git hash-object -t tag -w --literally latin-tag) + ) && + cgit_ok_url "foo/tag/&h=latin" >tmp && + test_grep "C? Mitter <committer@example.com>" tmp && + test_grep "
caf? release
" tmp && + test_grep ! "$(printf "\\351")" tmp +' + test_expect_success 'a tag page names the tag in its title' ' cgit_ok_url "foo/tag/&h=v1.0" >tmp && grep "v1.0 - foo - Git repository browser" tmp -- cgit 2.12.1