Skip to content

Commit b2f37d5

Browse files
newrengitster
authored andcommitted
t9350: fix encoding test to actually test reencoding
This test used an author with non-ascii characters in the name, but no special commit message. It then grep'ed for those non-ascii characters, but those are guaranteed to exist regardless of the reencoding process since the reencoding only affects the commit message, not the author or committer names. As such, the test would work even if the re-encoding process simply stripped the commit message entirely. Modify the test to actually check that the reencoding in utf-8 worked. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 83232e3 commit b2f37d5

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

t/t9350-fast-export.sh

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,32 @@ test_expect_success 'fast-export --show-original-ids | git fast-import' '
9494
test $MUSS = $(git rev-parse --verify refs/tags/muss)
9595
'
9696

97-
test_expect_success 'iso-8859-1' '
97+
test_expect_success 'iso-8859-7' '
9898
99-
git config i18n.commitencoding ISO8859-1 &&
100-
# use author and committer name in ISO-8859-1 to match it.
101-
. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
99+
test_when_finished "git reset --hard HEAD~1" &&
100+
test_config i18n.commitencoding iso-8859-7 &&
102101
test_tick &&
103102
echo rosten >file &&
104-
git commit -s -m den file &&
105-
git fast-export wer^..wer >iso8859-1.fi &&
106-
sed "s/wer/i18n/" iso8859-1.fi |
103+
git commit -s -F "$TEST_DIRECTORY/t9350/simple-iso-8859-7-commit-message.txt" file &&
104+
git fast-export wer^..wer >iso-8859-7.fi &&
105+
sed "s/wer/i18n/" iso-8859-7.fi |
107106
(cd new &&
108107
git fast-import &&
108+
# The commit object, if not re-encoded, would be 240 bytes.
109+
# Removing the "encoding iso-8859-7\n" header drops 20 bytes.
110+
# Re-encoding the Pi character from \xF0 in iso-8859-7 to
111+
# \xCF\x80 in utf-8 adds a byte. Grepping for specific bytes
112+
# would be nice, but Windows apparently munges user data
113+
# in the form of bytes on the command line to force them to
114+
# be characters instead, so we are limited for portability
115+
# reasons in subsequent similar tests in this file to check
116+
# for size rather than what bytes are present.
117+
test 221 -eq "$(git cat-file -s i18n)" &&
118+
# Also make sure the commit does not have the "encoding" header
109119
git cat-file commit i18n >actual &&
110-
grep "Áéí óú" actual)
111-
120+
! grep ^encoding actual)
112121
'
122+
113123
test_expect_success 'import/export-marks' '
114124
115125
git checkout -b marks master &&
@@ -224,7 +234,6 @@ GIT_COMMITTER_NAME='C O Mitter'; export GIT_COMMITTER_NAME
224234

225235
test_expect_success 'setup copies' '
226236
227-
git config --unset i18n.commitencoding &&
228237
git checkout -b copy rein &&
229238
git mv file file3 &&
230239
git commit -m move1 &&
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Pi: �

0 commit comments

Comments
 (0)