summaryrefslogtreecommitdiff
path: root/t/t3900-i18n-commit.sh
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2013-07-04 17:19:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-07-05 04:45:18 (GMT)
commit28110d4bfc613d875231d3d7788500d876136ffc (patch)
treea67b9e74f1df050de67d2026ec56a03c93709cbd /t/t3900-i18n-commit.sh
parent81a199bb1cd483321962a7bfe5db33980bbf0f01 (diff)
downloadgit-28110d4bfc613d875231d3d7788500d876136ffc.zip
git-28110d4bfc613d875231d3d7788500d876136ffc.tar.gz
git-28110d4bfc613d875231d3d7788500d876136ffc.tar.bz2
commit: reject invalid UTF-8 codepoints
The commit code already contains code for validating UTF-8, but it does not check for invalid values, such as guaranteed non-characters and surrogates. Fix this by explicitly checking for and rejecting such characters. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3900-i18n-commit.sh')
-rwxr-xr-xt/t3900-i18n-commit.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh
index 37ddabb..687669f 100755
--- a/t/t3900-i18n-commit.sh
+++ b/t/t3900-i18n-commit.sh
@@ -39,6 +39,14 @@ test_expect_failure 'UTF-16 refused because of NULs' '
git commit -a -F "$TEST_DIRECTORY"/t3900/UTF-16.txt
'
+test_expect_success 'UTF-8 invalid characters refused' '
+ test_when_finished "rm -f $HOME/stderr $HOME/invalid" &&
+ echo "UTF-8 characters" >F &&
+ printf "Commit message\n\nInvalid surrogate:\355\240\200\n" \
+ >"$HOME/invalid" &&
+ git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
+ grep "did not conform" "$HOME"/stderr
+'
for H in ISO8859-1 eucJP ISO-2022-JP
do