Skip to content

Commit 3738031

Browse files
peffgitster
authored andcommitted
git-sh-i18n: check GETTEXT_POISON before USE_GETTEXT_SCHEME
Running "make NO_GETTEXT=1 GETTEXT_POISON=1" currently fails t0205. While it might seem nonsensical at first glance to both poison and disable gettext, it's useful to be able to do a poison test-run on a system that doesn't have gettext at all. And it works fine for C programs; the problem is only with the shell code. The issue is that we check the baked-in USE_GETTEXT_SCHEME value before GETTEXT_POISON. And when NO_GETTEXT is set, the Makefile sets USE_GETTEXT_SCHEME to "fallthrough". So one fix would be to have the Makefile just set USE_GETTEXT_SCHEME to "poison" if GETTEXT_POISON is set. But there are two problems with that: 1. USE_GETTEXT_SCHEME is actually a user-facing knob, so conceivably somebody could override it with: make USE_GETTEXT_SCHEME=gnu GETTEXT_POISON=1 which would do the wrong thing (though that's much less likely than them having the variable set in their config.mak and just overriding GETTEXT_POISON on the command-line for a one-off test). 2. We don't actually bake GETTEXT_POISON in to the shell library like we do for the C code. It checks $GIT_GETTEXT_POISON at runtime, which is set up by the test suite. So it makes sense to put the fix in the runtime code, too, which would cover something like: GIT_GETTEXT_POISON=foo git foo It's not likely that people use the poison code outside of running the test suite, but it's easy enough to make this case work. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1cdc62f commit 3738031

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

git-sh-i18n.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ export TEXTDOMAINDIR
1717

1818
# First decide what scheme to use...
1919
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
20-
if test -n "@@USE_GETTEXT_SCHEME@@"
20+
if test -n "$GIT_GETTEXT_POISON"
21+
then
22+
GIT_INTERNAL_GETTEXT_SH_SCHEME=poison
23+
elif test -n "@@USE_GETTEXT_SCHEME@@"
2124
then
2225
GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
2326
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
2427
then
2528
: no probing necessary
26-
elif test -n "$GIT_GETTEXT_POISON"
27-
then
28-
GIT_INTERNAL_GETTEXT_SH_SCHEME=poison
2929
elif type gettext.sh >/dev/null 2>&1
3030
then
3131
# GNU libintl's gettext.sh

0 commit comments

Comments
 (0)