Subject: Re: [RFC/PATCH 1/5] gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)

From: Johannes Sixt <[email-masked]>
Date: Tue, 09 Nov 2010 13:22:10 +0100

Am 11/9/2010 12:57, schrieb Ævar Arnfjörð Bjarmason:
> How about if you just replace your tests with "cat". That should give
> a more accurate indication of what speed it *should* be operating at,
> once I fix those Makefile issues.

Just FYI:

$ time (for i in {1..100}; do eval_gettext2 foobar; done) > /dev/null

real    0m14.844s
user    0m11.635s
sys     0m4.372s

Please understand that on Windows there is a difference between cat, sed,
etc. and git. There is also a speed difference, which is annoying, but it
is fact and *not* a bug. You cannot argue with how the timings "should be".

> Anyway, if it's no more expensive than cat(1) (which it shouldn't be)
> it probably won't be a problem to use git-sh-i18n--envsubst.

It *is* more expensive.

BTW, current ab/i18n fails to compile when NO_GETTEXT is specified in
config.mak and libintl.h is not available. I suggest the fix below.

-- Hannes

diff --git a/Makefile b/Makefile
index c55baa6..e9ee142 100644
--- a/Makefile
+++ b/Makefile
@@ -619,9 +619,6 @@ LIB_OBJS += entry.o
 LIB_OBJS += environment.o
 LIB_OBJS += exec_cmd.o
 LIB_OBJS += fsck.o
-ifndef NO_GETTEXT
-LIB_OBJS += gettext.o
-endif
 LIB_OBJS += graph.o
 LIB_OBJS += grep.o
 LIB_OBJS += hash.o
@@ -1539,7 +1536,8 @@ endif

 ifdef NO_GETTEXT
 	COMPAT_CFLAGS += -DNO_GETTEXT
-endif
+else
+	LIB_OBJS += gettext.o

 ifdef NEEDS_LIBINTL
 	EXTLIBS += -lintl
@@ -1552,6 +1550,7 @@ endif
 ifdef GETTEXT_POISON
 	COMPAT_CFLAGS += -DGETTEXT_POISON
 endif
+endif

 ifeq ($(TCLTK_PATH),)
 NO_TCLTK=NoThanks