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 # extract just the log message and strip out committer info.
19 # don't use --limit here since svn 1.1.x doesn't have it,
20 LC_ALL
=en_US.UTF-8 svn log
`git svn info --url` | perl
-w -e '
24 @x = split(/\n/, $x[1]);
32 for H
in ISO8859-1 eucJP ISO-2022-JP
34 test_expect_success
"$H setup" '
36 svn_cmd import -m "$H test" $H "$svnrepo"/$H &&
37 git svn clone "$svnrepo"/$H $H
41 for H
in ISO8859-1 eucJP ISO-2022-JP
43 test_expect_success
"$H commit on git side" '
46 git config i18n.commitencoding $H &&
47 git checkout -b t refs/remotes/git-svn &&
50 git commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt &&
51 E=$(git cat-file commit HEAD | sed -ne "s/^encoding //p") &&
53 compare_git_head_with "$TEST_DIRECTORY"/t3900/$H.txt
58 for H
in ISO8859-1 eucJP ISO-2022-JP
60 test_expect_success
"$H dcommit to svn" '
64 git cat-file commit HEAD | grep git-svn-id: &&
65 E=$(git cat-file commit HEAD | sed -ne "s/^encoding //p") &&
67 compare_git_head_with "$TEST_DIRECTORY"/t3900/$H.txt
72 if locale
-a |
grep -q en_US.utf8
; then
75 say
"UTF-8 locale not available, test skipped"
78 test_expect_success UTF8
'ISO-8859-1 should match UTF-8 in svn' '
81 compare_svn_head_with "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
85 for H
in eucJP ISO-2022-JP
87 test_expect_success UTF8
"$H should match UTF-8 in svn" '
90 compare_svn_head_with "$TEST_DIRECTORY"/t3900/2-UTF-8.txt