{"thread":{"id":"25744","subject":"[PATCH 002/160] Makefile: Set NO_GETTEXT=YesPlease on Windows & MinGW","startedAt":"2010-11-14T15:07:23Z","lastAt":"2010-11-16T00:53:23Z","messageCount":12,"participants":["Ævar Arnfjörð Bjarmason","Jonathan Nieder","Junio C Hamano","Erik Faye-Lund"],"isPatch":true,"patchVersion":1,"patchTotal":160},"messages":[{"id":"155854","messageId":"1289747245-23263-1-git-send-email-avarab@gmail.com","threadId":"25744","inReplyTo":null,"subject":"[PATCH 000/160] [PULL] ab/i18n rebased on ab/i18n-prereqs","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-11-14T15:07:23Z","receivedAt":"2010-11-14T15:07:23Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Here's an updated ab/i18n rebased on the new ab/i18n-prereqs\nseries. The major change here is this patch:\n\n    gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)\n\nWhich fixes eval_gettext to work using our own copy of envsubst(1). And:\n\n    Makefile: Set NO_GETTEXT=YesPlease on Windows & MinGW\n\nWhich implements Johannes Six's suggestion in \"[PATCH] Do not build\ni18n on Windows.\" to not build with gettext on Windows by default.\n\nThis series can be fetched from:\n\n    git://github.com/avar/git.git ab/i18n\n\nErik Faye-Lund (1):\n  gettext.c: use libcharset.h instead of langinfo.h when available\n\nJan Engelhardt (1):\n  po/de.po: complete German translation\n\nJan Krüger (1):\n  po/de.po: add German translation\n\nMarcin Cieślak (1):\n  po/pl.po: add Polish translation\n\nPeter Krefting (1):\n  po/sv.po: add Swedish translation\n\nRamkumar Ramachandra (1):\n  po/hi.po: add Hindi Translation\n\nSam Reed (1):\n  po/en_GB.po: add British English translation\n\nThomas Rast (1):\n  gettext tests: locate i18n lib&data correctly under --valgrind\n\nÆvar Arnfjörð Bjarmason (152):\n  gettext: add infrastructure for translating Git with gettext\n  Makefile: Set NO_GETTEXT=YesPlease on Windows & MinGW\n  gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)\n  gettext tests: rename test to work around GNU gettext bug\n  gettext: setlocale(LC_CTYPE, \"\") breaks Git's C function assumptions\n  Makefile: A variable for options used by xgettext(1) calls\n  Makefile: provide a --msgid-bugs-address to xgettext(1)\n  Makefile: tell xgettext(1) that our source is in UTF-8\n  Makefile: use variables and shorter lines for xgettext\n  builtin.h: Include gettext.h\n  gettext.c: work around us not using setlocale(LC_CTYPE, \"\")\n  gettext tests: add GETTEXT_POISON=YesPlease Makefile parameter\n  gettext tests: skip lib-gettext.sh tests under GETTEXT_POISON\n  gettextize: git-init basic messages\n  gettextize: git-init \"Initialized [...] repository\" message\n  gettext tests: test if $VERSION exists before using it\n  gettext tests: add detection for is_IS.ISO-8859-1 locale\n  gettext tests: test message re-encoding under Shell\n  gettext tests: test re-encoding with a UTF-8 msgid under Shell\n  gettext tests: mark a test message as not needing translation\n  po/is.po: add Icelandic translation\n  gettext tests: test message re-encoding under C\n  gettextize: git-clone basic messages\n  gettextize: git-clone \"Cloning into\" message\n  gettextize: git-add basic messages\n  gettextize: git-add \"no files added\" message\n  gettextize: git-add \"Use -f if you really want\" message\n  gettextize: git-add \"pathspec [...] did not match\" message\n  gettextize: git-add \"remove '%s'\" message\n  gettextize: git-add refresh_index message\n  gettextize: git-branch basic messages\n  gettextize: git-branch \"remote branch '%s' not found\" message\n  gettextize: git-branch \"Deleted branch [...]\" message\n  gettextize: git-branch \"git branch -v\" messages\n  gettextize: git-branch \"(no branch)\" message\n  gettextize: git-checkout basic messages\n  gettextize: git-checkout: our/their version message\n  gettextize: git-checkout describe_detached_head messages\n  gettextize: git-checkout \"HEAD is now at\" message\n  gettextize: git-checkout \"Switched to a .. branch\" message\n  gettextize: git-commit basic messages\n  gettextize: git-commit \"middle of a merge\" message\n  gettextize: git-commit formatting messages\n  gettextize: git-commit print_summary messages\n  gettextize: git-commit \"enter the commit message\" message\n  gettextize: git-commit advice messages\n  gettextize: git-diff basic messages\n  gettextize: git-fetch basic messages\n  gettextize: git-fetch formatting messages\n  gettextize: git-fetch update_local_ref messages\n  gettextize: git-fetch split up \"(non-fast-forward)\" message\n  gettextize: git-grep basic messages\n  gettextize: git-grep \"--open-files-in-pager\" message\n  gettextize: git-log basic messages\n  gettextize: git-log \"--OPT does not make sense\" messages\n  gettextize: git-merge basic messages\n  gettextize: git-merge \"Updating %s..%s\" message\n  gettextize: git-merge \"You have not concluded your merge\" messages\n  gettextize: git-merge \"Wonderful\" message\n  gettextize: git-mv basic messages\n  gettextize: git-mv \"bad\" messages\n  gettextize: git-rm basic messages\n  gettextize: git-reset basic messages\n  gettextize: git-reset reset_type_names messages\n  gettextize: git-reset \"Unstaged changes after reset\" message\n  gettextize: git-tag basic messages\n  gettextize: git-tag tag_template message\n  gettextize: git-push basic messages\n  gettextize: git-push \"prevent you from losing\" message\n  gettextize: git-status basic messages\n  gettextize: git-status \"nothing to commit\" messages\n  gettextize: git-status shortstatus messages\n  gettextize: git-status \"Changes to be committed\" message\n  gettextize: git-status \"Initial commit\" message\n  gettextize: git-status \"renamed: \" message\n  gettextize: git-archive basic messages\n  gettextize: git-bundle basic messages\n  gettextize: git-clean basic messages\n  gettextize: git-clean clean.requireForce messages\n  gettextize: git-describe basic messages\n  gettextize: git-gc basic messages\n  gettextize: git-gc \"Auto packing the repository\" message\n  gettextize: git-notes basic commands\n  gettextize: git-notes GIT_NOTES_REWRITE_MODE error message\n  gettextize: git-notes \"Refusing to %s notes in %s\" message\n  gettextize: git-revert basic messages\n  gettextize: git-revert \"Your local changes\" message\n  gettextize: git-revert literal \"me\" messages\n  gettextize: git-revert split up \"could not revert/apply\" message\n  gettextize: git-shortlog basic messages\n  Makefile: add GNU_GETTEXT, set when we expect GNU gettext\n  Makefile: MSGFMT=\"msgfmt --check\" under GNU_GETTEXT\n  gettext tests: add GETTEXT_POISON support for shell scripts\n  gettext tests: add GETTEXT_POISON tests for shell scripts\n  gettextize: git-am add git-sh-i18n\n  gettextize: git-am one-line gettext $msg; echo\n  gettextize: git-am multi-line getttext $msg; echo\n  gettextize: git-am eval_gettext messages\n  gettextize: git-am die messages\n  gettextize: git-am cannot_fallback messages\n  gettextize: git-am clean_abort messages\n  gettextize: git-am \"Apply?\" message\n  gettextize: git-am core say messages\n  gettextize: git-am printf(1) message to eval_gettext\n  gettext docs: add po/README file documenting Git's gettext\n  Makefile: only add gettext tests on XGETTEXT_INCLUDE_TESTS=YesPlease\n  gettext docs: add a \"Testing your changes\" section to po/README\n  gettext docs: add \"Marking strings for translation\" section in\n    po/README\n  gettext docs: the gettext.h C interface\n  gettext docs: the git-sh-i18n.sh Shell interface\n  gettext docs: the Git::I18N Perl interface\n  gettext docs: add \"Testing marked strings\" section to po/README\n  gettextize: git-pull add git-sh-i18n\n  gettextize: git-pull die messages\n  gettextize: git-pull eval_gettext + die message\n  gettextize: git-pull eval_gettext + warning message\n  gettextize: git-pull split up \"no candidate\" message\n  gettextize: git-pull \"You asked to pull\" message\n  gettextize: git-pull \"[...] not currently on a branch\" message\n  gettextize: git-pull \"rebase against\" / \"merge with\" messages\n  gettextize: git-submodule add git-sh-i18n\n  gettextize: git-submodule echo + eval_gettext messages\n  gettextize: git-submodule say + eval_gettext messages\n  gettextize: git-submodule die + eval_gettext messages\n  gettextize: git-submodule $update_module say + die messages\n  gettextize: git-submodule \"cached cannot be used\" message\n  gettextize: git-submodule \"Submodule change[...]\" messages\n  gettextize: git-submodule $errmsg messages\n  gettextize: git-submodule \"Entering [...]\" message\n  gettextize: git-submodule \"[...] path is ignored\" message\n  gettextize: git-submodule \"path not initialized\" message\n  gettextize: git-submodule \"blob\" and \"submodule\" messages\n  gettextize: git-stash add git-sh-i18n\n  gettextize: git-stash echo + gettext message\n  gettextize: git-stash say + gettext messages\n  gettextize: git-stash die + gettext messages\n  gettextize: git-stash die + eval_gettext messages\n  gettextize: git-stash die + eval_gettext $* messages\n  gettextize: git-stash die + eval_gettext $1 messages\n  gettextize: git-stash \"unknown option\" message\n  gettextize: git-stash drop_stash say/die messages\n  gettextize: git-bisect add git-sh-i18n\n  gettextize: git-bisect gettext + echo message\n  gettextize: git-bisect echo + gettext messages\n  gettextize: git-bisect echo + eval_gettext message\n  gettextize: git-bisect die + gettext messages\n  gettextize: git-bisect die + eval_gettext messages\n  gettextize: git-bisect bisect_run + $@ messages\n  gettextize: git-bisect bisect_reset + $1 messages\n  gettextize: git-bisect bisect_replay + $1 messages\n  gettextize: git-bisect [Y/n] messages\n  gettextize: git-bisect bisect_next_check \"You need to\" message\n\n .gitignore                          |    3 +\n Documentation/CodingGuidelines      |    7 +\n INSTALL                             |   12 +\n Makefile                            |  135 ++-\n builtin.h                           |    1 +\n builtin/add.c                       |   46 +-\n builtin/archive.c                   |   14 +-\n builtin/branch.c                    |   69 +-\n builtin/bundle.c                    |    6 +-\n builtin/checkout.c                  |   93 +-\n builtin/clean.c                     |   33 +-\n builtin/clone.c                     |   63 +-\n builtin/commit.c                    |  156 +-\n builtin/describe.c                  |   36 +-\n builtin/diff.c                      |   20 +-\n builtin/fetch.c                     |   82 +-\n builtin/gc.c                        |   24 +-\n builtin/grep.c                      |   34 +-\n builtin/init-db.c                   |   58 +-\n builtin/log.c                       |   68 +-\n builtin/merge.c                     |  124 +-\n builtin/mv.c                        |   32 +-\n builtin/notes.c                     |  134 +-\n builtin/push.c                      |   42 +-\n builtin/reset.c                     |   42 +-\n builtin/revert.c                    |   75 +-\n builtin/rm.c                        |   22 +-\n builtin/shortlog.c                  |    8 +-\n builtin/tag.c                       |   66 +-\n config.mak.in                       |    3 +\n configure.ac                        |   18 +\n daemon.c                            |    3 +\n fast-import.c                       |    3 +\n gettext.c                           |   35 +\n gettext.h                           |   22 +\n git-am.sh                           |   68 +-\n git-bisect.sh                       |   84 +-\n git-pull.sh                         |  147 +-\n git-sh-i18n.sh                      |   80 +\n git-stash.sh                        |   75 +-\n git-submodule.sh                    |   94 +-\n git.c                               |    3 +\n http-backend.c                      |    3 +\n http-fetch.c                        |    3 +\n http-push.c                         |    3 +\n imap-send.c                         |    3 +\n perl/Git/I18N.pm                    |   91 +\n perl/Makefile                       |    3 +-\n perl/Makefile.PL                    |   14 +-\n po/.gitignore                       |    1 +\n po/README                           |  209 ++\n po/de.po                            | 3609 +++++++++++++++++++++++++++++++++++\n po/en_GB.po                         | 2784 +++++++++++++++++++++++++++\n po/hi.po                            | 2787 +++++++++++++++++++++++++++\n po/is.po                            |  194 ++\n po/pl.po                            | 2793 +++++++++++++++++++++++++++\n po/sv.po                            | 3492 +++++++++++++++++++++++++++++++++\n sh-i18n--envsubst.c                 |  444 +++++\n shell.c                             |    3 +\n show-index.c                        |    3 +\n t/lib-gettext.sh                    |   92 +\n t/lib-httpd.sh                      |    2 +-\n t/t0001-init.sh                     |    2 +-\n t/t0200-gettext-basic.sh            |  111 ++\n t/t0200/test.c                      |   23 +\n t/t0200/test.perl                   |   14 +\n t/t0200/test.sh                     |   14 +\n t/t0201-gettext-fallbacks.sh        |   52 +\n t/t0202-gettext-perl.sh             |   27 +\n t/t0202/test.pl                     |  109 ++\n t/t0203-gettext-setlocale-sanity.sh |   26 +\n t/t0204-gettext-reencode-sanity.sh  |   78 +\n t/t0205-gettext-poison.sh           |   36 +\n t/t1200-tutorial.sh                 |    5 +-\n t/t2200-add-update.sh               |    2 +-\n t/t2204-add-ignored.sh              |   37 +-\n t/t3030-merge-recursive.sh          |    2 +-\n t/t3200-branch.sh                   |    2 +-\n t/t3203-branch-output.sh            |    2 +-\n t/t3501-revert-cherry-pick.sh       |    2 +-\n t/t3507-cherry-pick-conflict.sh     |    2 +-\n t/t3700-add.sh                      |   11 +-\n t/t4001-diff-rename.sh              |    4 +-\n t/t4014-format-patch.sh             |    2 +-\n t/t4150-am.sh                       |    5 +-\n t/t4151-am-abort.sh                 |    2 +-\n t/t5541-http-push.sh                |    7 +-\n t/t5601-clone.sh                    |    2 +-\n t/t6040-tracking-info.sh            |    2 +-\n t/t6120-describe.sh                 |    2 +-\n t/t7004-tag.sh                      |    1 +\n t/t7012-skip-worktree-writing.sh    |    4 +-\n t/t7060-wtstatus.sh                 |    2 +-\n t/t7102-reset.sh                    |    2 +-\n t/t7110-reset-merge.sh              |    6 +-\n t/t7201-co.sh                       |   10 +-\n t/t7300-clean.sh                    |    6 +-\n t/t7400-submodule-basic.sh          |    4 +-\n t/t7401-submodule-summary.sh        |   12 +-\n t/t7407-submodule-foreach.sh        |    4 +-\n t/t7500-commit.sh                   |    6 +-\n t/t7501-commit.sh                   |    7 +-\n t/t7502-commit.sh                   |   60 +-\n t/t7506-status-submodule.sh         |   28 +-\n t/t7508-status.sh                   |  115 +-\n t/t7600-merge.sh                    |    2 +-\n t/t7811-grep-open.sh                |    2 +-\n t/test-lib.sh                       |   10 +\n upload-pack.c                       |    3 +\n wt-status.c                         |  116 +-\n 110 files changed, 18581 insertions(+), 1075 deletions(-)\n create mode 100644 gettext.c\n create mode 100644 gettext.h\n create mode 100644 git-sh-i18n.sh\n create mode 100644 perl/Git/I18N.pm\n create mode 100644 po/.gitignore\n create mode 100644 po/README\n create mode 100644 po/de.po\n create mode 100644 po/en_GB.po\n create mode 100644 po/hi.po\n create mode 100644 po/is.po\n create mode 100644 po/pl.po\n create mode 100644 po/sv.po\n create mode 100644 sh-i18n--envsubst.c\n create mode 100644 t/lib-gettext.sh\n create mode 100755 t/t0200-gettext-basic.sh\n create mode 100644 t/t0200/test.c\n create mode 100644 t/t0200/test.perl\n create mode 100644 t/t0200/test.sh\n create mode 100755 t/t0201-gettext-fallbacks.sh\n create mode 100755 t/t0202-gettext-perl.sh\n create mode 100644 t/t0202/test.pl\n create mode 100755 t/t0203-gettext-setlocale-sanity.sh\n create mode 100755 t/t0204-gettext-reencode-sanity.sh\n create mode 100755 t/t0205-gettext-poison.sh\n\n-- \n1.7.2.3\n"},{"id":"155852","messageId":"1289747245-23263-2-git-send-email-avarab@gmail.com","threadId":"25744","inReplyTo":"1289747245-23263-1-git-send-email-avarab@gmail.com","subject":"[PATCH 002/160] Makefile: Set NO_GETTEXT=YesPlease on Windows & MinGW","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-11-14T15:07:24Z","receivedAt":"2010-11-14T15:07:24Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the Windows and MinGW build defaults to not build the gettext\ntools by default. Gettext hasn't yet been ported to the default\nenvironments on those systems, although Erik Faye-Lund is working on\nMinGW support.\n\nReported-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 426e0b1..67d94d3 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -826,6 +826,8 @@ ifeq ($(uname_S),Windows)\n \tNO_REGEX = YesPlease\n \tNO_CURL = YesPlease\n \tNO_PYTHON = YesPlease\n+\tNO_GETTEXT = YesPlease\n+\tNEEDS_LIBINTL =\n \tBLK_SHA1 = YesPlease\n \tNATIVE_CRLF = YesPlease\n \n@@ -878,6 +880,8 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tOBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo\n \tNO_REGEX = YesPlease\n \tNO_PYTHON = YesPlease\n+\tNO_GETTEXT = YesPlease\n+\tNEEDS_LIBINTL =\n \tBLK_SHA1 = YesPlease\n \tETAGS_TARGET = ETAGS\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch -Icompat/win32\n-- \n1.7.2.3\n"},{"id":"155853","messageId":"1289747245-23263-3-git-send-email-avarab@gmail.com","threadId":"25744","inReplyTo":"1289747245-23263-1-git-send-email-avarab@gmail.com","subject":"[PATCH 003/160] gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-11-14T15:07:25Z","receivedAt":"2010-11-14T15:07:25Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change eval_gettext(1) in git-sh-i18n.sh to use a modified version of\ngettext's envsubst(1) program, instead of using a clever (but broken)\nprintf + eval + printf trick.\n\nOur previous fallback would incorrectly handle cases where the\nvariable being interpolated contained spaces. E.g.:\n\n    cmd=\"git foo\"; eval_gettext \"command: \\$cmd\"\n\nWould emit \"command: gitfoo\", instead of the correct \"command: git\nfoo\". This happened with a message in git-am.sh that used the $cmdline\nvariable.\n\nTo work around this, and to improve our variable expansion behavior\n(eval has security issues) I've imported a stripped-down version of\ngettext's envsubst(1) program.\n\nUsing it we pass the latter of the two tests added along with this\npatch (the first one was just added for completeness).\n\nSince we want to test both our fallback eval_gettext() and the one\nwe'll end up using (i.e. on Solaris) the new tests are executed in\nboth t0200-gettext-basic.sh and t0201-gettext-fallbacks.sh.\n\nThese are the modifications I made to envsubst.c as I turned it into\nsh-i18n--envsubst.c:\n\n * Added our git-compat-util.h header for xrealloc() and friends.\n\n * Removed inclusion of gettext-specific headers.\n\n * Removed most of main() and replaced it with my own. The modified\n   version only does option parsing for --variables. That's all it\n   needs.\n\n * Modified error() invocations to use our error() instead of\n   error(3).\n\n * Replaced the gettext XNMALLOC(n, size) macro with just\n   xmalloc(n). Since XNMALLOC() only allocated char's.\n\n * Removed the string_list_destroy function. It's redundant (also in\n   the upstream code).\n\n * Replaced the use of stdbool.h (a C99 header) by doing the following\n   replacements on the code:\n\n    * s/bool/unsigned short int/g\n    * s/true/1/g\n    * s/false/0/g\n\nReported-by: Johannes Sixt <j.sixt@viscovery.net>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .gitignore                   |    1 +\n Makefile                     |    1 +\n git-sh-i18n.sh               |   14 +-\n sh-i18n--envsubst.c          |  444 ++++++++++++++++++++++++++++++++++++++++++\n t/lib-gettext.sh             |   24 +++\n t/t0200-gettext.sh           |    3 +\n t/t0201-gettext-fallbacks.sh |    3 +\n 7 files changed, 485 insertions(+), 5 deletions(-)\n create mode 100644 sh-i18n--envsubst.c\n\ndiff --git a/.gitignore b/.gitignore\nindex 80ca718..d2d9ec2 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -126,6 +126,7 @@\n /git-send-email\n /git-send-pack\n /git-sh-i18n\n+/git-sh-i18n--envsubst\n /git-sh-setup\n /git-shell\n /git-shortlog\ndiff --git a/Makefile b/Makefile\nindex 67d94d3..1ef4648 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -420,6 +420,7 @@ PROGRAM_OBJS += shell.o\n PROGRAM_OBJS += show-index.o\n PROGRAM_OBJS += upload-pack.o\n PROGRAM_OBJS += http-backend.o\n+PROGRAM_OBJS += sh-i18n--envsubst.o\n \n PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))\n \ndiff --git a/git-sh-i18n.sh b/git-sh-i18n.sh\nindex 698a000..3aac21c 100644\n--- a/git-sh-i18n.sh\n+++ b/git-sh-i18n.sh\n@@ -48,10 +48,12 @@ then\n \n \t# Solaris has a gettext(1) but no eval_gettext(1)\n \teval_gettext () {\n-\t\tgettext_out=$(gettext \"$1\")\n-\t\tgettext_eval=\"printf '%s' \\\"$gettext_out\\\"\"\n-\t\tprintf \"%s\" \"`eval \\\"$gettext_eval\\\"`\"\n+\t\tgettext \"$1\" | (\n+\t\t\texport PATH $(git sh-i18n--envsubst --variables \"$1\");\n+\t\t\tgit sh-i18n--envsubst \"$1\"\n+\t\t)\n \t}\n+\n else\n \t# Since gettext.sh isn't available we'll have to define our own\n \t# dummy pass-through functions.\n@@ -65,7 +67,9 @@ else\n \t}\n \n \teval_gettext () {\n-\t\tgettext_eval=\"printf '%s' \\\"$1\\\"\"\n-\t\tprintf \"%s\" \"`eval \\\"$gettext_eval\\\"`\"\n+\t\tprintf \"%s\" \"$1\" | (\n+\t\t\texport PATH $(git sh-i18n--envsubst --variables \"$1\");\n+\t\t\tgit sh-i18n--envsubst \"$1\"\n+\t\t)\n \t}\n fi\ndiff --git a/sh-i18n--envsubst.c b/sh-i18n--envsubst.c\nnew file mode 100644\nindex 0000000..8db71b1\n--- /dev/null\n+++ b/sh-i18n--envsubst.c\n@@ -0,0 +1,444 @@\n+/*\n+ * sh-i18n--envsubst.c - a stripped-down version of gettext's envsubst(1)\n+ *\n+ * Copyright (C) 2010 Ævar Arnfjörð Bjarmason\n+ *\n+ * This is a modified version of\n+ * 67d0871a8c:gettext-runtime/src/envsubst.c from the gettext.git\n+ * repository. It has been stripped down to only implement the\n+ * envsubst(1) features that we need in the git-sh-i18n fallbacks.\n+ *\n+ * The \"Close standard error\" part in main() is from\n+ * 8dac033df0:gnulib-local/lib/closeout.c. The copyright notices for\n+ * both files are reproduced immediately below.\n+ */\n+\n+#include \"git-compat-util.h\"\n+\n+/* Substitution of environment variables in shell format strings.\n+   Copyright (C) 2003-2007 Free Software Foundation, Inc.\n+   Written by Bruno Haible <bruno@clisp.org>, 2003.\n+\n+   This program is free software; you can redistribute it and/or modify\n+   it under the terms of the GNU General Public License as published by\n+   the Free Software Foundation; either version 2, or (at your option)\n+   any later version.\n+\n+   This program is distributed in the hope that it will be useful,\n+   but WITHOUT ANY WARRANTY; without even the implied warranty of\n+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+   GNU General Public License for more details.\n+\n+   You should have received a copy of the GNU General Public License\n+   along with this program; if not, write to the Free Software Foundation,\n+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */\n+\n+/* closeout.c - close standard output and standard error\n+   Copyright (C) 1998-2007 Free Software Foundation, Inc.\n+\n+   This program is free software; you can redistribute it and/or modify\n+   it under the terms of the GNU General Public License as published by\n+   the Free Software Foundation; either version 2, or (at your option)\n+   any later version.\n+\n+   This program is distributed in the hope that it will be useful,\n+   but WITHOUT ANY WARRANTY; without even the implied warranty of\n+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+   GNU General Public License for more details.\n+\n+   You should have received a copy of the GNU General Public License\n+   along with this program; if not, write to the Free Software Foundation,\n+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */\n+\n+#include <errno.h>\n+#include <getopt.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <string.h>\n+\n+/* If true, substitution shall be performed on all variables.  */\n+static unsigned short int all_variables;\n+\n+/* Forward declaration of local functions.  */\n+static void print_variables (const char *string);\n+static void note_variables (const char *string);\n+static void subst_from_stdin (void);\n+\n+int\n+main (int argc, char *argv[])\n+{\n+  /* Default values for command line options.  */\n+  unsigned short int show_variables = 0;\n+\n+  switch (argc)\n+\t{\n+\tcase 1:\n+\t  error (\"we won't substitute all variables on stdin for you\");\n+\t  /*\n+\t  all_variables = 1;\n+      subst_from_stdin ();\n+\t  */\n+\tcase 2:\n+\t  /* echo '$foo and $bar' | git sh-i18n--envsubst --variables '$foo and $bar' */\n+\t  all_variables = 0;\n+\t  note_variables (argv[1]);\n+      subst_from_stdin ();\n+\t  break;\n+\tcase 3:\n+\t  /* git sh-i18n--envsubst --variables '$foo and $bar' */\n+\t  if (strcmp(argv[1], \"--variables\"))\n+\t\terror (\"first argument must be --variables when two are given\");\n+\t  show_variables = 1;\n+      print_variables (argv[2]);\n+\t  break;\n+\tdefault:\n+\t  error (\"too many arguments\");\n+\t  break;\n+\t}\n+\n+  /* Close standard error.  This is simpler than fwriteerror_no_ebadf, because\n+     upon failure we don't need an errno - all we can do at this point is to\n+     set an exit status.  */\n+  errno = 0;\n+  if (ferror (stderr) || fflush (stderr))\n+    { \n+      fclose (stderr);\n+      exit (EXIT_FAILURE);\n+    }\n+  if (fclose (stderr) && errno != EBADF)\n+    exit (EXIT_FAILURE);\n+\n+  exit (EXIT_SUCCESS);\n+}\n+\n+/* Parse the string and invoke the callback each time a $VARIABLE or\n+   ${VARIABLE} construct is seen, where VARIABLE is a nonempty sequence\n+   of ASCII alphanumeric/underscore characters, starting with an ASCII\n+   alphabetic/underscore character.\n+   We allow only ASCII characters, to avoid dependencies w.r.t. the current\n+   encoding: While \"${\\xe0}\" looks like a variable access in ISO-8859-1\n+   encoding, it doesn't look like one in the BIG5, BIG5-HKSCS, GBK, GB18030,\n+   SHIFT_JIS, JOHAB encodings, because \\xe0\\x7d is a single character in these\n+   encodings.  */\n+static void\n+find_variables (const char *string,\n+\t\tvoid (*callback) (const char *var_ptr, size_t var_len))\n+{\n+  for (; *string != '\\0';)\n+    if (*string++ == '$')\n+      {\n+\tconst char *variable_start;\n+\tconst char *variable_end;\n+\tunsigned short int valid;\n+\tchar c;\n+\n+\tif (*string == '{')\n+\t  string++;\n+\n+\tvariable_start = string;\n+\tc = *string;\n+\tif ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_')\n+\t  {\n+\t    do\n+\t      c = *++string;\n+\t    while ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')\n+\t\t   || (c >= '0' && c <= '9') || c == '_');\n+\t    variable_end = string;\n+\n+\t    if (variable_start[-1] == '{')\n+\t      {\n+\t\tif (*string == '}')\n+\t\t  {\n+\t\t    string++;\n+\t\t    valid = 1;\n+\t\t  }\n+\t\telse\n+\t\t  valid = 0;\n+\t      }\n+\t    else\n+\t      valid = 1;\n+\n+\t    if (valid)\n+\t      callback (variable_start, variable_end - variable_start);\n+\t  }\n+      }\n+}\n+\n+\n+/* Print a variable to stdout, followed by a newline.  */\n+static void\n+print_variable (const char *var_ptr, size_t var_len)\n+{\n+  fwrite (var_ptr, var_len, 1, stdout);\n+  putchar ('\\n');\n+}\n+\n+/* Print the variables contained in STRING to stdout, each one followed by a\n+   newline.  */\n+static void\n+print_variables (const char *string)\n+{\n+  find_variables (string, &print_variable);\n+}\n+\n+\n+/* Type describing list of immutable strings,\n+   implemented using a dynamic array.  */\n+typedef struct string_list_ty string_list_ty;\n+struct string_list_ty\n+{\n+  const char **item;\n+  size_t nitems;\n+  size_t nitems_max;\n+};\n+\n+/* Initialize an empty list of strings.  */\n+static inline void\n+string_list_init (string_list_ty *slp)\n+{\n+  slp->item = NULL;\n+  slp->nitems = 0;\n+  slp->nitems_max = 0;\n+}\n+\n+/* Append a single string to the end of a list of strings.  */\n+static inline void\n+string_list_append (string_list_ty *slp, const char *s)\n+{\n+  /* Grow the list.  */\n+  if (slp->nitems >= slp->nitems_max)\n+    {\n+      size_t nbytes;\n+\n+      slp->nitems_max = slp->nitems_max * 2 + 4;\n+      nbytes = slp->nitems_max * sizeof (slp->item[0]);\n+      slp->item = (const char **) xrealloc (slp->item, nbytes);\n+    }\n+\n+  /* Add the string to the end of the list.  */\n+  slp->item[slp->nitems++] = s;\n+}\n+\n+/* Compare two strings given by reference.  */\n+static int\n+cmp_string (const void *pstr1, const void *pstr2)\n+{\n+  const char *str1 = *(const char **)pstr1;\n+  const char *str2 = *(const char **)pstr2;\n+\n+  return strcmp (str1, str2);\n+}\n+\n+/* Sort a list of strings.  */\n+static inline void\n+string_list_sort (string_list_ty *slp)\n+{\n+  if (slp->nitems > 0)\n+    qsort (slp->item, slp->nitems, sizeof (slp->item[0]), cmp_string);\n+}\n+\n+/* Test whether a string list contains a given string.  */\n+static inline int\n+string_list_member (const string_list_ty *slp, const char *s)\n+{\n+  size_t j;\n+\n+  for (j = 0; j < slp->nitems; ++j)\n+    if (strcmp (slp->item[j], s) == 0)\n+      return 1;\n+  return 0;\n+}\n+\n+/* Test whether a sorted string list contains a given string.  */\n+static int\n+sorted_string_list_member (const string_list_ty *slp, const char *s)\n+{\n+  size_t j1, j2;\n+\n+  j1 = 0;\n+  j2 = slp->nitems;\n+  if (j2 > 0)\n+    {\n+      /* Binary search.  */\n+      while (j2 - j1 > 1)\n+\t{\n+\t  /* Here we know that if s is in the list, it is at an index j\n+\t     with j1 <= j < j2.  */\n+\t  size_t j = (j1 + j2) >> 1;\n+\t  int result = strcmp (slp->item[j], s);\n+\n+\t  if (result > 0)\n+\t    j2 = j;\n+\t  else if (result == 0)\n+\t    return 1;\n+\t  else\n+\t    j1 = j + 1;\n+\t}\n+      if (j2 > j1)\n+\tif (strcmp (slp->item[j1], s) == 0)\n+\t  return 1;\n+    }\n+  return 0;\n+}\n+\n+\n+/* Set of variables on which to perform substitution.\n+   Used only if !all_variables.  */\n+static string_list_ty variables_set;\n+\n+/* Adds a variable to variables_set.  */\n+static void\n+note_variable (const char *var_ptr, size_t var_len)\n+{\n+  char *string = xmalloc (var_len + 1);\n+  memcpy (string, var_ptr, var_len);\n+  string[var_len] = '\\0';\n+\n+  string_list_append (&variables_set, string);\n+}\n+\n+/* Stores the variables occurring in the string in variables_set.  */\n+static void\n+note_variables (const char *string)\n+{\n+  string_list_init (&variables_set);\n+  find_variables (string, &note_variable);\n+  string_list_sort (&variables_set);\n+}\n+\n+\n+static int\n+do_getc ()\n+{\n+  int c = getc (stdin);\n+\n+  if (c == EOF)\n+    {\n+      if (ferror (stdin))\n+\terror (\"error while reading standard input\");\n+    }\n+\n+  return c;\n+}\n+\n+static inline void\n+do_ungetc (int c)\n+{\n+  if (c != EOF)\n+    ungetc (c, stdin);\n+}\n+\n+/* Copies stdin to stdout, performing substitutions.  */\n+static void\n+subst_from_stdin ()\n+{\n+  static char *buffer;\n+  static size_t bufmax;\n+  static size_t buflen;\n+  int c;\n+\n+  for (;;)\n+    {\n+      c = do_getc ();\n+      if (c == EOF)\n+\tbreak;\n+      /* Look for $VARIABLE or ${VARIABLE}.  */\n+      if (c == '$')\n+\t{\n+\t  unsigned short int opening_brace = 0;\n+\t  unsigned short int closing_brace = 0;\n+\n+\t  c = do_getc ();\n+\t  if (c == '{')\n+\t    {\n+\t      opening_brace = 1;\n+\t      c = do_getc ();\n+\t    }\n+\t  if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_')\n+\t    {\n+\t      unsigned short int valid;\n+\n+\t      /* Accumulate the VARIABLE in buffer.  */\n+\t      buflen = 0;\n+\t      do\n+\t\t{\n+\t\t  if (buflen >= bufmax)\n+\t\t    {\n+\t\t      bufmax = 2 * bufmax + 10;\n+\t\t      buffer = xrealloc (buffer, bufmax);\n+\t\t    }\n+\t\t  buffer[buflen++] = c;\n+\n+\t\t  c = do_getc ();\n+\t\t}\n+\t      while ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')\n+\t\t     || (c >= '0' && c <= '9') || c == '_');\n+\n+\t      if (opening_brace)\n+\t\t{\n+\t\t  if (c == '}')\n+\t\t    {\n+\t\t      closing_brace = 1;\n+\t\t      valid = 1;\n+\t\t    }\n+\t\t  else\n+\t\t    {\n+\t\t      valid = 0;\n+\t\t      do_ungetc (c);\n+\t\t    }\n+\t\t}\n+\t      else\n+\t\t{\n+\t\t  valid = 1;\n+\t\t  do_ungetc (c);\n+\t\t}\n+\n+\t      if (valid)\n+\t\t{\n+\t\t  /* Terminate the variable in the buffer.  */\n+\t\t  if (buflen >= bufmax)\n+\t\t    {\n+\t\t      bufmax = 2 * bufmax + 10;\n+\t\t      buffer = xrealloc (buffer, bufmax);\n+\t\t    }\n+\t\t  buffer[buflen] = '\\0';\n+\n+\t\t  /* Test whether the variable shall be substituted.  */\n+\t\t  if (!all_variables\n+\t\t      && !sorted_string_list_member (&variables_set, buffer))\n+\t\t    valid = 0;\n+\t\t}\n+\n+\t      if (valid)\n+\t\t{\n+\t\t  /* Substitute the variable's value from the environment.  */\n+\t\t  const char *env_value = getenv (buffer);\n+\n+\t\t  if (env_value != NULL)\n+\t\t    fputs (env_value, stdout);\n+\t\t}\n+\t      else\n+\t\t{\n+\t\t  /* Perform no substitution at all.  Since the buffered input\n+\t\t     contains no other '$' than at the start, we can just\n+\t\t     output all the buffered contents.  */\n+\t\t  putchar ('$');\n+\t\t  if (opening_brace)\n+\t\t    putchar ('{');\n+\t\t  fwrite (buffer, buflen, 1, stdout);\n+\t\t  if (closing_brace)\n+\t\t    putchar ('}');\n+\t\t}\n+\t    }\n+\t  else\n+\t    {\n+\t      do_ungetc (c);\n+\t      putchar ('$');\n+\t      if (opening_brace)\n+\t\tputchar ('{');\n+\t    }\n+\t}\n+      else\n+\tputchar (c);\n+    }\n+}\ndiff --git a/t/lib-gettext.sh b/t/lib-gettext.sh\nindex 831ee38..f0101fc 100644\n--- a/t/lib-gettext.sh\n+++ b/t/lib-gettext.sh\n@@ -40,3 +40,27 @@ else\n \ttest_set_prereq NO_GETTEXT\n \tsay \"# lib-gettext: No GETTEXT support available\"\n fi\n+\n+test_eval_gettext_interpolation() {\n+\ttest_expect_success NO_GETTEXT_POISON 'eval_gettext: our eval_gettext() fallback can interpolate whitespace variables' '\n+\t    git_am_cmdline=\"git am\" &&\n+\t    printf \"test git am\" >expect &&\n+\t    eval_gettext \"test \\$git_am_cmdline\" >actual &&\n+\t    test_cmp expect actual\n+\t'\n+\n+\ttest_expect_success NO_GETTEXT_POISON 'eval_gettext: git am $cmdline bug' '\n+\t    cmdline=\"git am -3\" &&\n+\t    export cmdline &&\n+\t    cat >expect <<EOF &&\n+When you have resolved this problem run \"git am -3 --resolved\".\n+If you would prefer to skip this patch, instead run \"git am -3 --skip\".\n+To restore the original branch and stop patching run \"git am -3 --abort\".\n+EOF\n+\t    eval_gettext \"When you have resolved this problem run \\\"\\$cmdline --resolved\\\".\n+If you would prefer to skip this patch, instead run \\\"\\$cmdline --skip\\\".\n+To restore the original branch and stop patching run \\\"\\$cmdline --abort\\\".\" >actual &&\n+\t    echo >>actual &&\n+\t    test_cmp expect actual\n+\t'\n+}\ndiff --git a/t/t0200-gettext.sh b/t/t0200-gettext.sh\nindex 8853d8a..58948fa 100755\n--- a/t/t0200-gettext.sh\n+++ b/t/t0200-gettext.sh\n@@ -105,4 +105,7 @@ test_expect_success GETTEXT_LOCALE 'sanity: Some gettext(\"\") data for real local\n     test -s real-locale\n '\n \n+# Test eval_gettext() interpolation with the actual eval_gettext function\n+test_eval_gettext_interpolation\n+\n test_done\ndiff --git a/t/t0201-gettext-fallbacks.sh b/t/t0201-gettext-fallbacks.sh\nindex 47ce4f6..d2dc4af 100755\n--- a/t/t0201-gettext-fallbacks.sh\n+++ b/t/t0201-gettext-fallbacks.sh\n@@ -46,4 +46,7 @@ test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate v\n     test_cmp expect actual\n '\n \n+# Test eval_gettext() interpolation with the fallback eval_gettext function\n+test_eval_gettext_interpolation\n+\n test_done\n-- \n1.7.2.3\n"},{"id":"155866","messageId":"20101114181605.GI26459@burratino","threadId":"25744","inReplyTo":"1289747245-23263-3-git-send-email-avarab@gmail.com","subject":"Re: [PATCH 003/160] gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-11-14T18:16:05Z","receivedAt":"2010-11-14T18:16:05Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> These are the modifications I made to envsubst.c as I turned it into\n> sh-i18n--envsubst.c:\n> \n>  * Added our git-compat-util.h header for xrealloc() and friends.\n> \n>  * Removed inclusion of gettext-specific headers.\n> \n>  * Removed most of main() and replaced it with my own. The modified\n>    version only does option parsing for --variables. That's all it\n>    needs.\n> \n>  * Modified error() invocations to use our error() instead of\n>    error(3).\n> \n>  * Replaced the gettext XNMALLOC(n, size) macro with just\n>    xmalloc(n). Since XNMALLOC() only allocated char's.\n> \n>  * Removed the string_list_destroy function. It's redundant (also in\n>    the upstream code).\n> \n>  * Replaced the use of stdbool.h (a C99 header) by doing the following\n>    replacements on the code:\n\nNit: can this be moved to a subdir?  Maybe po or i18n, or even\nenvsubst.  This could make it clearer that the code has an upstream\nand should be updated when upstream is.\n\nJonathan\n"},{"id":"155871","messageId":"7vmxpb1ztf.fsf@alter.siamese.dyndns.org","threadId":"25744","inReplyTo":"20101114181605.GI26459@burratino","subject":"Re: [PATCH 003/160] gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-11-14T19:15:56Z","receivedAt":"2010-11-14T19:15:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Nit: can this be moved to a subdir?  Maybe po or i18n, or even\n> envsubst.  This could make it clearer that the code has an upstream\n> and should be updated when upstream is.\n\nIOW, just like \"xdiff/\" is a separate directory.  I think that is a sane\nthing to do.\n\nThanks.\n"},{"id":"155879","messageId":"AANLkTinh_Nkxvw7Z5HU=TbJHHFRZeWgr0COJ+N96OeTd@mail.gmail.com","threadId":"25744","inReplyTo":"7vmxpb1ztf.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 003/160] gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-11-14T21:25:08Z","receivedAt":"2010-11-14T21:25:08Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sun, Nov 14, 2010 at 20:15, Junio C Hamano <gitster@pobox.com> wrote:\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n>> Nit: can this be moved to a subdir?  Maybe po or i18n, or even\n>> envsubst.  This could make it clearer that the code has an upstream\n>> and should be updated when upstream is.\n>\n> IOW, just like \"xdiff/\" is a separate directory.  I think that is a sane\n> thing to do.\n\nThanks for the suggestion. I'll put it in envsubst/ then.\n\nAny idea about the issue of it being linked to too many things? I\ntried to add another entry to this section:\n\n    git-%$X: %.o $(GITLIBS)\n        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter\n%.o,$^) $(LIBS)\n\n    git-imap-send$X: imap-send.o $(GITLIBS)\n        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n            $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)\n\nBut it wasn't actually used. But then again I don't know Makefile\nhacking that much.\n"},{"id":"155880","messageId":"20101114212757.GD10150@burratino","threadId":"25744","inReplyTo":"AANLkTinh_Nkxvw7Z5HU=TbJHHFRZeWgr0COJ+N96OeTd@mail.gmail.com","subject":"Re: [PATCH 003/160] gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-11-14T21:27:57Z","receivedAt":"2010-11-14T21:27:57Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> Thanks for the suggestion. I'll put it in envsubst/ then.\n> \n> Any idea about the issue of it being linked to too many things?\n\nMaybe http://thread.gmane.org/gmane.comp.version-control.git/160842\nis related?\n\n> tried to add another entry to this section:\n> \n>     git-%$X: %.o $(GITLIBS)\n>         $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter\n> %.o,$^) $(LIBS)\n> \n>     git-imap-send$X: imap-send.o $(GITLIBS)\n>         $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n>             $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)\n> \n> But it wasn't actually used. But then again I don't know Makefile\n> hacking that much.\n\nIf you send output from \"make envsubst\" from your attempt with V=1,\nI can try to debug it.\n"},{"id":"155883","messageId":"AANLkTim-j6TLwz0PugZvaEf1x3hW=76vT1gALC=w3DOu@mail.gmail.com","threadId":"25744","inReplyTo":"20101114212757.GD10150@burratino","subject":"Re: [PATCH 003/160] gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-11-14T21:42:57Z","receivedAt":"2010-11-14T21:42:57Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sun, Nov 14, 2010 at 22:27, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Ævar Arnfjörð Bjarmason wrote:\n>\n>> Thanks for the suggestion. I'll put it in envsubst/ then.\n>>\n>> Any idea about the issue of it being linked to too many things?\n>\n> Maybe http://thread.gmane.org/gmane.comp.version-control.git/160842\n> is related?\n>\n>> tried to add another entry to this section:\n>>\n>>     git-%$X: %.o $(GITLIBS)\n>>         $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter\n>> %.o,$^) $(LIBS)\n>>\n>>     git-imap-send$X: imap-send.o $(GITLIBS)\n>>         $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n>>             $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)\n>>\n>> But it wasn't actually used. But then again I don't know Makefile\n>> hacking that much.\n>\n> If you send output from \"make envsubst\" from your attempt with V=1,\n> I can try to debug it.\n\nThis is how it currently gets compiled:\n\n    $ rm git-sh-i18n--envsubst sh-i18n--envsubst.o; make -j 5 all V=1\n    gcc -o sh-i18n--envsubst.o -c   -g -O2 -Wall -I.  -DHAVE_PATHS_H\n-DSHA1_HEADER='<openssl/sha.h>'  -DNO_STRLCPY -DNO_MKSTEMPS\nsh-i18n--envsubst.c\n    gcc  -g -O2 -Wall -I.  -DHAVE_PATHS_H\n-DSHA1_HEADER='<openssl/sha.h>'  -DNO_STRLCPY -DNO_MKSTEMPS -o\ngit-sh-i18n--envsubst   sh-i18n--envsubst.o libgit.a xdiff/lib.a  -lz\n-lcrypto -lpthread\n\nI tried to remove some of those library includes. But it'll\ncomplain. However if I do:\n\n    diff --git a/sh-i18n--envsubst.c b/sh-i18n--envsubst.c\n    index 8db71b1..7d4c870 100644\n    --- a/sh-i18n--envsubst.c\n    +++ b/sh-i18n--envsubst.c\n    @@ -215 +215 @@ string_list_append (string_list_ty *slp, const char *s)\n    -      slp->item = (const char **) xrealloc (slp->item, nbytes);\n    +      slp->item = (const char **) realloc (slp->item, nbytes);\n    @@ -293 +293 @@ note_variable (const char *var_ptr, size_t var_len)\n    -  char *string = xmalloc (var_len + 1);\n    +  char *string = malloc (var_len + 1);\n    @@ -368 +368 @@ subst_from_stdin ()\n    -                     buffer = xrealloc (buffer, bufmax);\n    +                     buffer = realloc (buffer, bufmax);\n    @@ -402 +402 @@ subst_from_stdin ()\n    -                     buffer = xrealloc (buffer, bufmax);\n    +                     buffer = realloc (buffer, bufmax);\n\nIt'll compile stand-alone with no library includes at all. Maybe I\nshould just modify it to have basic versions of those two x* functions\nso we can compile it completely stand-alone.\n"},{"id":"155885","messageId":"20101114214731.GA16413@burratino","threadId":"25744","inReplyTo":"AANLkTim-j6TLwz0PugZvaEf1x3hW=76vT1gALC=w3DOu@mail.gmail.com","subject":"Re: [PATCH 003/160] gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-11-14T21:47:32Z","receivedAt":"2010-11-14T21:47:32Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> This is how it currently gets compiled:\n> \n>     $ rm git-sh-i18n--envsubst sh-i18n--envsubst.o; make -j 5 all V=1\n>     gcc -o sh-i18n--envsubst.o -c   -g -O2 -Wall -I.  -DHAVE_PATHS_H\n> -DSHA1_HEADER='<openssl/sha.h>'  -DNO_STRLCPY -DNO_MKSTEMPS\n> sh-i18n--envsubst.c\n>     gcc  -g -O2 -Wall -I.  -DHAVE_PATHS_H\n> -DSHA1_HEADER='<openssl/sha.h>'  -DNO_STRLCPY -DNO_MKSTEMPS -o\n> git-sh-i18n--envsubst   sh-i18n--envsubst.o libgit.a xdiff/lib.a  -lz\n> -lcrypto -lpthread\n> \n> I tried to remove some of those library includes. But it'll\n> complain. However if I do:\n> \n>     diff --git a/sh-i18n--envsubst.c b/sh-i18n--envsubst.c\n>     index 8db71b1..7d4c870 100644\n>     --- a/sh-i18n--envsubst.c\n>     +++ b/sh-i18n--envsubst.c\n>     @@ -215 +215 @@ string_list_append (string_list_ty *slp, const char *s)\n>     -      slp->item = (const char **) xrealloc (slp->item, nbytes);\n>     +      slp->item = (const char **) realloc (slp->item, nbytes);\n[...]\n> It'll compile stand-alone with no library includes at all.\n\nYes, that is what $gmane/160842 is about (also see $gmane/137738 for\nbackground).  In this case, a simple local stub xmalloc/xrealloc etc\nto take care of checking for NULL seems fine, indeed.\n"},{"id":"155893","messageId":"AANLkTik4ds++er=MpLOZZ9DbhADbBrckyW3u0ydxbiv+@mail.gmail.com","threadId":"25744","inReplyTo":"20101114214731.GA16413@burratino","subject":"Re: [PATCH 003/160] gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-11-14T22:26:25Z","receivedAt":"2010-11-14T22:26:25Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sun, Nov 14, 2010 at 22:47, Jonathan Nieder <jrnieder@gmail.com> wrote:\n\n> Yes, that is what $gmane/160842 is about (also see $gmane/137738 for\n> background).  In this case, a simple local stub xmalloc/xrealloc etc\n> to take care of checking for NULL seems fine, indeed.\n\nIndeed. The problem is that even if I did that I couldn't convince the\nMakefile in cooperating with creating my binary in a special\nway. That's what I needed help with.\n\nThen again I'm not a Makefile wiz and only tried to poke it for 20\nminutes or so. So I might be missing something obvious.\n"},{"id":"155911","messageId":"AANLkTin2sMUBtS_WgVX39ngRGrWRLf=Z_+UhGNorP6VH@mail.gmail.com","threadId":"25744","inReplyTo":"1289747245-23263-2-git-send-email-avarab@gmail.com","subject":"Re: [PATCH 002/160] Makefile: Set NO_GETTEXT=YesPlease on Windows & MinGW","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2010-11-15T10:35:15Z","receivedAt":"2010-11-15T10:35:15Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"(msysgit mailing list CC'ed)\n\nOn Sun, Nov 14, 2010 at 4:07 PM, Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n> Change the Windows and MinGW build defaults to not build the gettext\n> tools by default. Gettext hasn't yet been ported to the default\n> environments on those systems, although Erik Faye-Lund is working on\n> MinGW support.\n>\n> Reported-by: Johannes Sixt <j6t@kdbg.org>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n\nI don't think this is exactly what Hannes reported; IIRC he reported\nthat setting NO_GETTEXT wasn't sufficient to get it to build. Just\nunsetting NEEDS_LIBINTL for a platform that doesn't have gettext is\ncuring the symptoms rather than the decease, shouldn't the build\nsystem and/or the code be fixed so setting NO_GETTEXT is sufficient\ninstead?\n\nAs a side-note, I think it might be time to merge the gettext-branch\ninto msysGit soon. If no one complains, I'll get it done one of the\nnext days.\n"},{"id":"155962","messageId":"AANLkTikqG5mkAbF4+xtBkDs8_ML9Uwn=xLvtcnDFXXuB@mail.gmail.com","threadId":"25744","inReplyTo":"1289747245-23263-1-git-send-email-avarab@gmail.com","subject":"Re: [PATCH 000/160] [PULL] ab/i18n rebased on ab/i18n-prereqs","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-11-16T00:53:23Z","receivedAt":"2010-11-16T00:53:23Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sun, Nov 14, 2010 at 16:07, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> Here's an updated ab/i18n rebased on the new ab/i18n-prereqs\n> series. The major change here is this patch:\n\nI've rebased ab/i18n and ab/i18n-prereqs again to account for the\nmaster Junio pushed out which contains two of the ab/i18n-prereqs\npatches.\n"}]}