3 # Copyright (c) 2008 Eric Wong
5 test_description
='git svn honors i18n.commitEncoding in config'
7 TEST_FAILS_SANITIZE_LEAK
=true
10 compare_git_head_with
() {
14 git cat-file commit HEAD |
sed -ne "$a,${b}p" >current
&&
20 compare_svn_head_with
() {
21 # extract just the log message and strip out committer info.
22 # don't use --limit here since svn 1.1.x doesn't have it,
23 LC_ALL
="$GIT_TEST_UTF8_LOCALE" svn log $
(git svn info
--url) | perl
-w -e '
27 @x = split(/\n/, $x[1]);
35 for H
in ISO8859-1 eucJP ISO-2022-JP
37 test_expect_success
"$H setup" '
39 svn_cmd import -m "$H test" $H "$svnrepo"/$H &&
40 git svn clone "$svnrepo"/$H $H
44 for H
in ISO8859-1 eucJP ISO-2022-JP
46 test_expect_success
"$H commit on git side" '
49 git config i18n.commitencoding $H &&
50 git checkout -b t refs/remotes/git-svn &&
53 git commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt &&
54 E=$(git cat-file commit HEAD | sed -ne "s/^encoding //p") &&
56 compare_git_head_with "$TEST_DIRECTORY"/t3900/$H.txt
61 for H
in ISO8859-1 eucJP ISO-2022-JP
63 test_expect_success
"$H dcommit to svn" '
67 git cat-file commit HEAD | grep git-svn-id: &&
68 E=$(git cat-file commit HEAD | sed -ne "s/^encoding //p") &&
70 compare_git_head_with "$TEST_DIRECTORY"/t3900/$H.txt
75 test_expect_success UTF8
'ISO-8859-1 should match UTF-8 in svn' '
78 compare_svn_head_with "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
82 for H
in eucJP ISO-2022-JP
84 test_expect_success UTF8
"$H should match UTF-8 in svn" '
87 compare_svn_head_with "$TEST_DIRECTORY"/t3900/2-UTF-8.txt