@@ -184,7 +184,7 @@ osx-clang|osx-gcc)
export GIT_SKIP_TESTS="t9810 t9816"
;;
GIT_TEST_GETTEXT_POISON)
- export GIT_TEST_GETTEXT_POISON=YesPlease
+ export GIT_TEST_GETTEXT_POISON=true
;;
esac
@@ -50,10 +50,8 @@ const char *get_preferred_languages(void)
int use_gettext_poison(void)
{
static int poison_requested = -1;
- if (poison_requested == -1) {
- const char *v = getenv("GIT_TEST_GETTEXT_POISON");
- poison_requested = v && strlen(v) ? 1 : 0;
- }
+ if (poison_requested == -1)
+ poison_requested = git_env_bool("GIT_TEST_GETTEXT_POISON", 0);
return poison_requested;
}
@@ -17,7 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "$GIT_TEST_GETTEXT_POISON"
+if test -n "$GIT_TEST_GETTEXT_POISON" &&
+ git env--helper --mode-bool --variable=GIT_TEST_GETTEXT_POISON \
+ --default=0 --exit-code --quiet
then
GIT_INTERNAL_GETTEXT_SH_SCHEME=poison
elif test -n "@@USE_GETTEXT_SCHEME@@"
@@ -293,7 +293,7 @@ To smoke out issues like these, Git tested with a translation mode that
emits gibberish on every call to gettext. To use it run the test suite
with it, e.g.:
- cd t && GIT_TEST_GETTEXT_POISON=YesPlease prove -j 9 ./t[0-9]*.sh
+ cd t && GIT_TEST_GETTEXT_POISON=true prove -j 9 ./t[0-9]*.sh
If tests break with it you should inspect them manually and see if
what you're translating is sane, i.e. that you're not translating
@@ -343,8 +343,8 @@ whether this mode is active, and e.g. skip some tests that are hard to
refactor to deal with it. The "SYMLINKS" prerequisite is currently
excluded as so much relies on it, but this might change in the future.
-GIT_TEST_GETTEXT_POISON=<non-empty?> turns all strings marked for
-translation into gibberish if non-empty (think "test -n"). Used for
+GIT_TEST_GETTEXT_POISON=<boolean> turns all strings marked for
+translation into gibberish if true. Used for
spotting those tests that need to be marked with a C_LOCALE_OUTPUT
prerequisite when adding more strings for translation. See "Testing
marked strings" in po/README for details.
@@ -5,7 +5,7 @@
test_description='Gettext Shell poison'
-GIT_TEST_GETTEXT_POISON=YesPlease
+GIT_TEST_GETTEXT_POISON=true
export GIT_TEST_GETTEXT_POISON
. ./lib-gettext.sh
@@ -249,7 +249,7 @@ test_expect_success 'checkout to detach HEAD (with advice declined)' '
test_expect_success 'checkout to detach HEAD' '
git config advice.detachedHead true &&
git checkout -f renamer && git clean -f &&
- GIT_TEST_GETTEXT_POISON= git checkout renamer^ 2>messages &&
+ GIT_TEST_GETTEXT_POISON=false git checkout renamer^ 2>messages &&
grep "HEAD is now at 7329388" messages &&
test_line_count -gt 1 messages &&
H=$(git rev-parse --verify HEAD) &&
@@ -1706,7 +1706,7 @@ test_expect_success 'sourcing the completion script clears cached commands' '
'
test_expect_success 'sourcing the completion script clears cached merge strategies' '
- GIT_TEST_GETTEXT_POISON= &&
+ GIT_TEST_GETTEXT_POISON=false &&
__git_compute_merge_strategies &&
verbose test -n "$__git_merge_strategies" &&
. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" &&
@@ -1443,6 +1443,10 @@ then
unset GIT_TEST_GETTEXT_POISON_ORIG
fi
+test_lazy_prereq C_LOCALE_OUTPUT '
+ ! git env--helper --mode-bool --variable=GIT_TEST_GETTEXT_POISON --default=0 --exit-code --quiet
+'
+
# Can we rely on git's output in the C locale?
if test -z "$GIT_TEST_GETTEXT_POISON"
then
Change the GIT_TEST_GETTEXT_POISON variable from being "non-empty?" to being a more standard boolean variable. Since it needed to be checked in both C code and shellscript (via test -n) it was one of the remaining shellscript-like variables. Now that we have "git env--helper" we can change that. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- ci/lib.sh | 2 +- gettext.c | 6 ++---- git-sh-i18n.sh | 4 +++- po/README | 2 +- t/README | 4 ++-- t/t0205-gettext-poison.sh | 2 +- t/t7201-co.sh | 2 +- t/t9902-completion.sh | 2 +- t/test-lib.sh | 4 ++++ 9 files changed, 16 insertions(+), 12 deletions(-)