3 # Copyright (c) 2008 Eric Wong
5 test_description
='git svn honors i18n.commitEncoding in config'
9 compare_git_head_with
() {
13 git cat-file commit HEAD |
sed -ne "$a,${b}p" >current
&&
17 compare_svn_head_with
() {
18 LC_ALL
=en_US.UTF-8 svn log
--limit 1 `git svn info --url` | \
19 sed -e 1,3d
-e "/^-\+\$/d" >current
&&
23 for H
in ISO-8859-1 EUCJP ISO-2022-JP
25 test_expect_success
"$H setup" '
27 svn import -m "$H test" $H "$svnrepo"/$H &&
28 git svn clone "$svnrepo"/$H $H
32 for H
in ISO-8859-1 EUCJP ISO-2022-JP
34 test_expect_success
"$H commit on git side" '
37 git config i18n.commitencoding $H &&
38 git checkout -b t refs/remotes/git-svn &&
41 git commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt &&
42 E=$(git cat-file commit HEAD | sed -ne "s/^encoding //p") &&
44 compare_git_head_with "$TEST_DIRECTORY"/t3900/$H.txt
49 for H
in ISO-8859-1 EUCJP ISO-2022-JP
51 test_expect_success
"$H dcommit to svn" '
55 git cat-file commit HEAD | grep git-svn-id: &&
56 E=$(git cat-file commit HEAD | sed -ne "s/^encoding //p") &&
58 compare_git_head_with "$TEST_DIRECTORY"/t3900/$H.txt
63 test_expect_success
'ISO-8859-1 should match UTF-8 in svn' '
66 compare_svn_head_with "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
70 for H
in EUCJP ISO-2022-JP
72 test_expect_success
'$H should match UTF-8 in svn' '
75 compare_svn_head_with "$TEST_DIRECTORY"/t3900/2-UTF-8.txt