summaryrefslogtreecommitdiff
path: root/t/t3900-i18n-commit.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-12-15 20:47:23 +0700
committerJunio C Hamano <gitster@pobox.com>2011-12-15 11:35:10 -0800
commit37576c14439a4dfa43bec5a5c953fea1cc436bbf (patch)
treeab64240830bfce6d1308787f193ff8f0f77c21c0 /t/t3900-i18n-commit.sh
parent13f8b72d8c8e24215a3dd7771592b30083f1c740 (diff)
downloadgit-37576c14439a4dfa43bec5a5c953fea1cc436bbf.tar.gz
commit_tree(): refuse commit messages that contain NULsnd/war-on-nul-in-commit
Current implementation sees NUL as terminator. If users give a message with NUL byte in it (e.g. editor set to save as UTF-16), the new commit message will have NULs. However following operations (displaying or amending a commit for example) will not keep anything after the first NUL. Stop user right when they do this. If NUL is added by mistake, they have their chance to fix. Otherwise, log messages will no longer be text "git log" and friends would grok. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3900-i18n-commit.sh')
-rwxr-xr-xt/t3900-i18n-commit.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh
index 1f62c151b0..d48a7c002d 100755
--- a/t/t3900-i18n-commit.sh
+++ b/t/t3900-i18n-commit.sh
@@ -34,6 +34,12 @@ test_expect_success 'no encoding header for base case' '
test z = "z$E"
'
+test_expect_failure 'UTF-16 refused because of NULs' '
+ echo UTF-16 >F &&
+ git commit -a -F "$TEST_DIRECTORY"/t3900/UTF-16.txt
+'
+
+
for H in ISO8859-1 eucJP ISO-2022-JP
do
test_expect_success "$H setup" '