dir-iterator: support iteration in sorted order
[git.git] / t / t9129-git-svn-i18n-commitencoding.sh
blob185248a4cd766172969ad88f7dcd94258733f644
1 #!/bin/sh
3 # Copyright (c) 2008 Eric Wong
5 test_description='git svn honors i18n.commitEncoding in config'
7 TEST_FAILS_SANITIZE_LEAK=true
8 . ./lib-git-svn.sh
10 compare_git_head_with () {
11 nr=$(wc -l < "$1")
12 a=7
13 b=$(($a + $nr - 1))
14 git cat-file commit HEAD | sed -ne "$a,${b}p" >current &&
15 test_cmp current "$1"
18 prepare_utf8_locale
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 '
24 use bytes;
25 $/ = ("-"x72) . "\n";
26 my @x = <STDIN>;
27 @x = split(/\n/, $x[1]);
28 splice(@x, 0, 2);
29 $x[-1] = "";
30 print join("\n", @x);
31 ' > current &&
32 test_cmp current "$1"
35 for H in ISO8859-1 eucJP ISO-2022-JP
37 test_expect_success "$H setup" '
38 mkdir $H &&
39 svn_cmd import -m "$H test" $H "$svnrepo"/$H &&
40 git svn clone "$svnrepo"/$H $H
42 done
44 for H in ISO8859-1 eucJP ISO-2022-JP
46 test_expect_success "$H commit on git side" '
48 cd $H &&
49 git config i18n.commitencoding $H &&
50 git checkout -b t refs/remotes/git-svn &&
51 echo $H >F &&
52 git add F &&
53 git commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt &&
54 E=$(git cat-file commit HEAD | sed -ne "s/^encoding //p") &&
55 test "z$E" = "z$H" &&
56 compare_git_head_with "$TEST_DIRECTORY"/t3900/$H.txt
59 done
61 for H in ISO8859-1 eucJP ISO-2022-JP
63 test_expect_success "$H dcommit to svn" '
65 cd $H &&
66 git svn dcommit &&
67 git cat-file commit HEAD | grep git-svn-id: &&
68 E=$(git cat-file commit HEAD | sed -ne "s/^encoding //p") &&
69 test "z$E" = "z$H" &&
70 compare_git_head_with "$TEST_DIRECTORY"/t3900/$H.txt
73 done
75 test_expect_success UTF8 'ISO-8859-1 should match UTF-8 in svn' '
77 cd ISO8859-1 &&
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" '
86 cd $H &&
87 compare_svn_head_with "$TEST_DIRECTORY"/t3900/2-UTF-8.txt
90 done
92 test_done