Imported Upstream version 2.20.2
[platform/upstream/git.git] / t / t9129-git-svn-i18n-commitencoding.sh
index 9a40f1e..2c213ae 100755 (executable)
@@ -7,29 +7,19 @@ test_description='git svn honors i18n.commitEncoding in config'
 . ./lib-git-svn.sh
 
 compare_git_head_with () {
-       nr=`wc -l < "$1"`
+       nr=$(wc -l < "$1")
        a=7
        b=$(($a + $nr - 1))
        git cat-file commit HEAD | sed -ne "$a,${b}p" >current &&
        test_cmp current "$1"
 }
 
-a_utf8_locale=$(locale -a | sed -n '/\.[uU][tT][fF]-*8$/{
-       p
-       q
-}')
-
-if test -n "$a_utf8_locale"
-then
-       test_set_prereq UTF8
-else
-       say "# UTF-8 locale not available, some tests are skipped"
-fi
+prepare_a_utf8_locale
 
 compare_svn_head_with () {
        # extract just the log message and strip out committer info.
        # don't use --limit here since svn 1.1.x doesn't have it,
-       LC_ALL="$a_utf8_locale" svn log `git svn info --url` | "$PERL_PATH" -w -e '
+       LC_ALL="$a_utf8_locale" svn log $(git svn info --url) | perl -w -e '
                use bytes;
                $/ = ("-"x72) . "\n";
                my @x = <STDIN>;
@@ -61,7 +51,7 @@ do
                git add F &&
                git commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt &&
                E=$(git cat-file commit HEAD | sed -ne "s/^encoding //p") &&
-               test "z$E" = "z$H"
+               test "z$E" = "z$H" &&
                compare_git_head_with "$TEST_DIRECTORY"/t3900/$H.txt
        )
        '