From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Ævar Arnfjörð" <avarab@gmail.com>,
"Jonathan Nieder" <jrnieder@gmail.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 4/6] Initialize gettext for test programs that may use it
Date: Fri, 24 Aug 2012 12:43:04 +0700 [thread overview]
Message-ID: <1345786986-10826-5-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1345786986-10826-1-git-send-email-pclouds@gmail.com>
Gettext poison was a macro and _() always returned
"# GETTEXT POISON #". Now that we use real gettext(),
it has to be initialized or it won't work.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
test-date.c | 1 +
test-delta.c | 1 +
test-dump-cache-tree.c | 5 ++++-
test-index-version.c | 1 +
test-match-trees.c | 1 +
test-mergesort.c | 1 +
test-parse-options.c | 1 +
test-path-utils.c | 1 +
test-revision-walking.c | 1 +
test-scrap-cache-tree.c | 4 +++-
test-sha1.c | 1 +
test-subprocess.c | 1 +
12 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/test-date.c b/test-date.c
index 10afaab..3881d33 100644
--- a/test-date.c
+++ b/test-date.c
@@ -48,6 +48,7 @@ int main(int argc, char **argv)
struct timeval now;
const char *x;
+ git_setup_gettext();
x = getenv("TEST_DATE_NOW");
if (x) {
now.tv_sec = atoi(x);
diff --git a/test-delta.c b/test-delta.c
index af40a3c..ac86cae 100644
--- a/test-delta.c
+++ b/test-delta.c
@@ -22,6 +22,7 @@ int main(int argc, char *argv[])
void *from_buf, *data_buf, *out_buf;
unsigned long from_size, data_size, out_size;
+ git_setup_gettext();
if (argc != 5 || (strcmp(argv[1], "-d") && strcmp(argv[1], "-p"))) {
fprintf(stderr, "Usage: %s\n", usage_str);
return 1;
diff --git a/test-dump-cache-tree.c b/test-dump-cache-tree.c
index a6ffdf3..2023475 100644
--- a/test-dump-cache-tree.c
+++ b/test-dump-cache-tree.c
@@ -56,7 +56,10 @@ static int dump_cache_tree(struct cache_tree *it,
int main(int ac, char **av)
{
- struct cache_tree *another = cache_tree();
+ struct cache_tree *another;
+
+ git_setup_gettext();
+ another = cache_tree();
if (read_cache() < 0)
die("unable to read index file");
cache_tree_update(another, active_cache, active_nr, WRITE_TREE_DRY_RUN);
diff --git a/test-index-version.c b/test-index-version.c
index bfaad9e..703f4bd 100644
--- a/test-index-version.c
+++ b/test-index-version.c
@@ -5,6 +5,7 @@ int main(int argc, const char **argv)
struct cache_header hdr;
int version;
+ git_setup_gettext();
memset(&hdr,0,sizeof(hdr));
if (read(0, &hdr, sizeof(hdr)) != sizeof(hdr))
return 0;
diff --git a/test-match-trees.c b/test-match-trees.c
index a3c4688..5299292 100644
--- a/test-match-trees.c
+++ b/test-match-trees.c
@@ -6,6 +6,7 @@ int main(int ac, char **av)
unsigned char hash1[20], hash2[20], shifted[20];
struct tree *one, *two;
+ git_setup_gettext();
if (get_sha1(av[1], hash1))
die("cannot parse %s as an object name", av[1]);
if (get_sha1(av[2], hash2))
diff --git a/test-mergesort.c b/test-mergesort.c
index 3f388b4..2289cb1 100644
--- a/test-mergesort.c
+++ b/test-mergesort.c
@@ -27,6 +27,7 @@ int main(int argc, const char **argv)
struct line *line, *p = NULL, *lines = NULL;
struct strbuf sb = STRBUF_INIT;
+ git_setup_gettext();
for (;;) {
if (strbuf_getwholeline(&sb, stdin, '\n'))
break;
diff --git a/test-parse-options.c b/test-parse-options.c
index 3c9510a..4a94327 100644
--- a/test-parse-options.c
+++ b/test-parse-options.c
@@ -81,6 +81,7 @@ int main(int argc, const char **argv)
};
int i;
+ git_setup_gettext();
argc = parse_options(argc, argv, prefix, options, usage, 0);
printf("boolean: %d\n", boolean);
diff --git a/test-path-utils.c b/test-path-utils.c
index 3bc20e9..f3b4cee 100644
--- a/test-path-utils.c
+++ b/test-path-utils.c
@@ -2,6 +2,7 @@
int main(int argc, char **argv)
{
+ git_setup_gettext();
if (argc == 3 && !strcmp(argv[1], "normalize_path_copy")) {
char *buf = xmalloc(PATH_MAX + 1);
int rv = normalize_path_copy(buf, argv[2]);
diff --git a/test-revision-walking.c b/test-revision-walking.c
index 3ade02c..5f476c0 100644
--- a/test-revision-walking.c
+++ b/test-revision-walking.c
@@ -47,6 +47,7 @@ static int run_revision_walk(void)
int main(int argc, char **argv)
{
+ git_setup_gettext();
if (argc < 2)
return 1;
diff --git a/test-scrap-cache-tree.c b/test-scrap-cache-tree.c
index 4728013..67234e1 100644
--- a/test-scrap-cache-tree.c
+++ b/test-scrap-cache-tree.c
@@ -6,7 +6,9 @@ static struct lock_file index_lock;
int main(int ac, char **av)
{
- int fd = hold_locked_index(&index_lock, 1);
+ int fd;
+ git_setup_gettext();
+ fd = hold_locked_index(&index_lock, 1);
if (read_cache() < 0)
die("unable to read index file");
active_cache_tree = NULL;
diff --git a/test-sha1.c b/test-sha1.c
index 80daba9..9a02ce8 100644
--- a/test-sha1.c
+++ b/test-sha1.c
@@ -7,6 +7,7 @@ int main(int ac, char **av)
unsigned bufsz = 8192;
char *buffer;
+ git_setup_gettext();
if (ac == 2)
bufsz = strtoul(av[1], NULL, 10) * 1024 * 1024;
diff --git a/test-subprocess.c b/test-subprocess.c
index f2d4c0d..9cf8e29 100644
--- a/test-subprocess.c
+++ b/test-subprocess.c
@@ -6,6 +6,7 @@ int main(int argc, const char **argv)
struct child_process cp;
int nogit = 0;
+ git_setup_gettext();
setup_git_directory_gently(&nogit);
if (nogit)
die("No git repo found");
--
1.7.12.rc2
next prev parent reply other threads:[~2012-08-24 5:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-24 5:43 [PATCH 0/6] Gettext poison rework Nguyễn Thái Ngọc Duy
2012-08-24 5:43 ` [PATCH 1/6] Makefile: do not mark strings for l10n from test programs Nguyễn Thái Ngọc Duy
2012-08-24 5:43 ` [PATCH 2/6] Makefile: recreate git.pot if *.sh or *.perl changes Nguyễn Thái Ngọc Duy
2012-08-24 5:43 ` [PATCH 3/6] Replace gettext poison implementation with pseudotranslation generation Nguyễn Thái Ngọc Duy
2012-08-24 5:43 ` Nguyễn Thái Ngọc Duy [this message]
2012-08-24 5:43 ` [PATCH 5/6] Support logging unmarked strings Nguyễn Thái Ngọc Duy
2012-08-24 5:43 ` [PATCH 6/6] test-parse-options: mark parseopt help strings for pseudotranslation Nguyễn Thái Ngọc Duy
2012-08-24 8:51 ` [PATCH 0/6] Gettext poison rework Ævar Arnfjörð Bjarmason
2012-08-24 10:54 ` Nguyen Thai Ngoc Duy
2012-08-24 16:02 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1345786986-10826-5-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.