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 a_utf8_locale
=$
(locale
-a |
sed -n '/\.[uU][tT][fF]-*8$/{
22 if test -n "$a_utf8_locale"
26 say
"# UTF-8 locale not available, some tests are skipped"
29 compare_svn_head_with
() {
30 # extract just the log message and strip out committer info.
31 # don't use --limit here since svn 1.1.x doesn't have it,
32 LC_ALL
="$a_utf8_locale" svn log
`git svn info --url` | perl
-w -e '
36 @x = split(/\n/, $x[1]);
44 for H
in ISO8859-1 eucJP ISO-2022-JP
46 test_expect_success
"$H setup" '
48 svn_cmd import -m "$H test" $H "$svnrepo"/$H &&
49 git svn clone "$svnrepo"/$H $H
53 for H
in ISO8859-1 eucJP ISO-2022-JP
55 test_expect_success
"$H commit on git side" '
58 git config i18n.commitencoding $H &&
59 git checkout -b t refs/remotes/git-svn &&
62 git commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt &&
63 E=$(git cat-file commit HEAD | sed -ne "s/^encoding //p") &&
65 compare_git_head_with "$TEST_DIRECTORY"/t3900/$H.txt
70 for H
in ISO8859-1 eucJP ISO-2022-JP
72 test_expect_success
"$H dcommit to svn" '
76 git cat-file commit HEAD | grep git-svn-id: &&
77 E=$(git cat-file commit HEAD | sed -ne "s/^encoding //p") &&
79 compare_git_head_with "$TEST_DIRECTORY"/t3900/$H.txt
84 test_expect_success UTF8
'ISO-8859-1 should match UTF-8 in svn' '
87 compare_svn_head_with "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
91 for H
in eucJP ISO-2022-JP
93 test_expect_success UTF8
"$H should match UTF-8 in svn" '
96 compare_svn_head_with "$TEST_DIRECTORY"/t3900/2-UTF-8.txt