summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-07-25 20:59:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-07-25 20:59:20 (GMT)
commit023ff4cdf5793437313f481b4ef5b1ec247f2301 (patch)
treefe222b4b3edeb442b7873d89d03556a1e11c1274 /config.c
parent9c9b961d7eb15fb583a2a812088713a68a85f1c0 (diff)
parent08a8ac88d868f3206e8faf0df2502ebc18925c33 (diff)
downloadgit-023ff4cdf5793437313f481b4ef5b1ec247f2301.zip
git-023ff4cdf5793437313f481b4ef5b1ec247f2301.tar.gz
git-023ff4cdf5793437313f481b4ef5b1ec247f2301.tar.bz2
Merge branch 'ab/test-env'
Many GIT_TEST_* environment variables control various aspects of how our tests are run, but a few followed "non-empty is true, empty or unset is false" while others followed the usual "there are a few ways to spell true, like yes, on, etc., and also ways to spell false, like no, off, etc." convention. * ab/test-env: env--helper: mark a file-local symbol as static tests: make GIT_TEST_FAIL_PREREQS a boolean tests: replace test_tristate with "git env--helper" tests README: re-flow a previously changed paragraph tests: make GIT_TEST_GETTEXT_POISON a boolean t6040 test: stop using global "script" variable config.c: refactor die_bad_number() to not call gettext() early env--helper: new undocumented builtin wrapping git_env_*() config tests: simplify include cycle test
Diffstat (limited to 'config.c')
-rw-r--r--config.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/config.c b/config.c
index faa57e4..ed7f58e 100644
--- a/config.c
+++ b/config.c
@@ -973,34 +973,44 @@ int git_parse_ssize_t(const char *value, ssize_t *ret)
NORETURN
static void die_bad_number(const char *name, const char *value)
{
- const char * error_type = (errno == ERANGE)? _("out of range"):_("invalid unit");
+ const char *error_type = (errno == ERANGE) ?
+ N_("out of range") : N_("invalid unit");
+ const char *bad_numeric = N_("bad numeric config value '%s' for '%s': %s");
if (!value)
value = "";
+ if (!strcmp(name, "GIT_TEST_GETTEXT_POISON"))
+ /*
+ * We explicitly *don't* use _() here since it would
+ * cause an infinite loop with _() needing to call
+ * use_gettext_poison(). This is why marked up
+ * translations with N_() above.
+ */
+ die(bad_numeric, value, name, error_type);
+
if (!(cf && cf->name))
- die(_("bad numeric config value '%s' for '%s': %s"),
- value, name, error_type);
+ die(_(bad_numeric), value, name, _(error_type));
switch (cf->origin_type) {
case CONFIG_ORIGIN_BLOB:
die(_("bad numeric config value '%s' for '%s' in blob %s: %s"),
- value, name, cf->name, error_type);
+ value, name, cf->name, _(error_type));
case CONFIG_ORIGIN_FILE:
die(_("bad numeric config value '%s' for '%s' in file %s: %s"),
- value, name, cf->name, error_type);
+ value, name, cf->name, _(error_type));
case CONFIG_ORIGIN_STDIN:
die(_("bad numeric config value '%s' for '%s' in standard input: %s"),
- value, name, error_type);
+ value, name, _(error_type));
case CONFIG_ORIGIN_SUBMODULE_BLOB:
die(_("bad numeric config value '%s' for '%s' in submodule-blob %s: %s"),
- value, name, cf->name, error_type);
+ value, name, cf->name, _(error_type));
case CONFIG_ORIGIN_CMDLINE:
die(_("bad numeric config value '%s' for '%s' in command line %s: %s"),
- value, name, cf->name, error_type);
+ value, name, cf->name, _(error_type));
default:
die(_("bad numeric config value '%s' for '%s' in %s: %s"),
- value, name, cf->name, error_type);
+ value, name, cf->name, _(error_type));
}
}