t9129: fix UTF-8 locale detection
The UTF-8 prerequisite test checked explicitly for en_US.utf8 in the output from "locale -a", but the tests that are actually protected by the prerequisite were asking LC_ALL=en_US.UTF-8 from the system. This inconsistency leads the tests to fail on platforms that do not know both en_US.UTF-8 and en_US.utf8 (thanks you, Yann Droneaud, for bringing this up with an initial patch). Instead, pick a locale with ".UTF-8" (with or without hyphen, spelled in either upper or lowercase) in its name from "locale -a" output, and use it for running the test. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 2, 2010 at 12:15 UTC
2de03ebe0635c93e182c3367140f999e79bdadcd
1 file changed
+13
-7
t/t9129-git-svn-i18n-commitencoding.sh
+13
-7
@@ -14,10 +14,22 @@ compare_git_head_with () {
14
test_cmp current "$1"
15
}
16
17
+a_utf8_locale=$(locale -a | sed -n '/\.[uU][tT][fF]-*8$/{
18
+ p
19
+ q
20
+}')
21
+
22
+if test -n "$a_utf8_locale"
23
+then
24
+ test_set_prereq UTF8
25
+else
26
+ say "UTF-8 locale not available, some tests are skipped"
27
+fi
28
+
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,
20
- LC_ALL=en_US.UTF-8 svn log `git svn info --url` | perl -w -e '
32
+ LC_ALL="$a_utf8_locale" svn log `git svn info --url` | perl -w -e '
33
use bytes;
34
$/ = ("-"x72) . "\n";
35
my @x = <STDIN>;
@@ -69,12 +81,6 @@ do
81
'
82
done
83
72
-if locale -a |grep -q en_US.utf8; then
73
- test_set_prereq UTF8
74
-else
75
- say "UTF-8 locale not available, test skipped"
76
-fi
77
-
84
test_expect_success UTF8 'ISO-8859-1 should match UTF-8 in svn' '
85
(
86
cd ISO8859-1 &&