summaryrefslogtreecommitdiff
path: root/t/lib-git-svn.sh
diff options
context:
space:
mode:
authorĐoàn Trần Công Danh <congdanhqx@gmail.com>2021-06-08 06:56:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-06-08 07:07:37 (GMT)
commit482c962de4af32471a5ab770160731a028fcd9d6 (patch)
tree528c6dea32da508397e8d87b2c771aa15c40c3f6 /t/lib-git-svn.sh
parent48bf2fa8bad054d66bd79c6ba903c89c704201f7 (diff)
downloadgit-482c962de4af32471a5ab770160731a028fcd9d6.zip
git-482c962de4af32471a5ab770160731a028fcd9d6.tar.gz
git-482c962de4af32471a5ab770160731a028fcd9d6.tar.bz2
t: use user-specified utf-8 locale for testing svn
In some test-cases, UTF-8 locale is required. To find such locale, we're using the first available UTF-8 locale that returned by "locale -a". However, the locale(1) utility is unavailable on some systems, e.g. Linux with musl libc. However, without "locale -a", we can't guess provided UTF-8 locale. Add a Makefile knob GIT_TEST_UTF8_LOCALE and activate it for linux-musl in our CI system. Rename t/lib-git-svn.sh:prepare_a_utf8_locale to prepare_utf8_locale, since we no longer prepare the variable named "a_utf8_locale", but set up a fallback value for GIT_TEST_UTF8_LOCALE instead. The fallback will be LC_ALL, LANG environment variable, or the first UTF-8 locale from output of "locale -a", in that order. Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-git-svn.sh')
-rw-r--r--t/lib-git-svn.sh22
1 files changed, 16 insertions, 6 deletions
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 547eb3c..2fde235 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -121,12 +121,22 @@ start_svnserve () {
--listen-host 127.0.0.1 &
}
-prepare_a_utf8_locale () {
- a_utf8_locale=$(locale -a | sed -n '/\.[uU][tT][fF]-*8$/{
- p
- q
-}')
- if test -n "$a_utf8_locale"
+prepare_utf8_locale () {
+ if test -z "$GIT_TEST_UTF8_LOCALE"
+ then
+ case "${LC_ALL:-$LANG}" in
+ *.[Uu][Tt][Ff]8 | *.[Uu][Tt][Ff]-8)
+ GIT_TEST_UTF8_LOCALE="${LC_ALL:-$LANG}"
+ ;;
+ *)
+ GIT_TEST_UTF8_LOCALE=$(locale -a | sed -n '/\.[uU][tT][fF]-*8$/{
+ p
+ q
+ }')
+ ;;
+ esac
+ fi
+ if test -n "$GIT_TEST_UTF8_LOCALE"
then
test_set_prereq UTF8
else