* [PATCH v2 1/2] config.c: mark error and warnings strings for translation
@ 2014-07-31 13:42 Tanay Abhra
2014-07-31 13:42 ` [PATCH 2/2] add variable name to `git_config_*()` error message Tanay Abhra
2014-07-31 13:50 ` [PATCH v2 1/2] config.c: mark error and warnings strings for translation Matthieu Moy
0 siblings, 2 replies; 4+ messages in thread
From: Tanay Abhra @ 2014-07-31 13:42 UTC (permalink / raw)
To: git; +Cc: Matthieu Moy, Ramkumar Ramachandra, Matthieu Moy
From: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
v2: error messages now start with a small letter.
config.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/config.c b/config.c
index 058505c..7330789 100644
--- a/config.c
+++ b/config.c
@@ -442,9 +442,9 @@ static int git_parse_source(config_fn_t fn, void *data)
break;
}
if (cf->die_on_error)
- die("bad config file line %d in %s", cf->linenr, cf->name);
+ die(_("bad config file line %d in %s"), cf->linenr, cf->name);
else
- return error("bad config file line %d in %s", cf->linenr, cf->name);
+ return error(_("bad config file line %d in %s"), cf->linenr, cf->name);
}
static int parse_unit_factor(const char *end, uintmax_t *val)
@@ -560,9 +560,9 @@ static void die_bad_number(const char *name, const char *value)
value = "";
if (cf && cf->name)
- die("bad numeric config value '%s' for '%s' in %s: %s",
+ die(_("bad numeric config value '%s' for '%s' in %s: %s"),
value, name, cf->name, reason);
- die("bad numeric config value '%s' for '%s': %s", value, name, reason);
+ die(_("bad numeric config value '%s' for '%s': %s"), value, name, reason);
}
int git_config_int(const char *name, const char *value)
@@ -647,7 +647,7 @@ int git_config_pathname(const char **dest, const char *var, const char *value)
return config_error_nonbool(var);
*dest = expand_user_path(value);
if (!*dest)
- die("Failed to expand user dir in: '%s'", value);
+ die(_("failed to expand user dir in: '%s'"), value);
return 0;
}
@@ -725,7 +725,7 @@ static int git_default_core_config(const char *var, const char *value)
if (level == -1)
level = Z_DEFAULT_COMPRESSION;
else if (level < 0 || level > Z_BEST_COMPRESSION)
- die("bad zlib compression level %d", level);
+ die(_("bad zlib compression level %d"), level);
zlib_compression_level = level;
zlib_compression_seen = 1;
return 0;
@@ -736,7 +736,7 @@ static int git_default_core_config(const char *var, const char *value)
if (level == -1)
level = Z_DEFAULT_COMPRESSION;
else if (level < 0 || level > Z_BEST_COMPRESSION)
- die("bad zlib compression level %d", level);
+ die(_("bad zlib compression level %d"), level);
core_compression_level = level;
core_compression_seen = 1;
if (!zlib_compression_seen)
@@ -858,7 +858,7 @@ static int git_default_core_config(const char *var, const char *value)
else if (!strcmp(value, "link"))
object_creation_mode = OBJECT_CREATION_USES_HARDLINKS;
else
- die("Invalid mode for object creation: %s", value);
+ die(_("invalid mode for object creation: %s"), value);
return 0;
}
@@ -1158,7 +1158,7 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)
switch (git_config_from_parameters(fn, data)) {
case -1: /* error */
- die("unable to parse command-line config");
+ die(_("unable to parse command-line config"));
break;
case 0: /* found nothing */
break;
@@ -1243,7 +1243,7 @@ static int store_aux(const char *key, const char *value, void *cb)
case KEY_SEEN:
if (matches(key, value)) {
if (store.seen == 1 && store.multi_replace == 0) {
- warning("%s has multiple values", key);
+ warning(_("%s has multiple values"), key);
}
ALLOC_GROW(store.offset, store.seen + 1,
--
1.9.0.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] add variable name to `git_config_*()` error message
2014-07-31 13:42 [PATCH v2 1/2] config.c: mark error and warnings strings for translation Tanay Abhra
@ 2014-07-31 13:42 ` Tanay Abhra
2014-07-31 15:23 ` Tanay Abhra
2014-07-31 13:50 ` [PATCH v2 1/2] config.c: mark error and warnings strings for translation Matthieu Moy
1 sibling, 1 reply; 4+ messages in thread
From: Tanay Abhra @ 2014-07-31 13:42 UTC (permalink / raw)
To: git; +Cc: Tanay Abhra, Ramkumar Ramachandra, Matthieu Moy
Whenever a callback returns a negative value, the functions
of `git_config_*()` family die printing the line number and
file name. In addition to them, add the variable name to the
error message.
Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
---
config.c | 4 ++--
t/t4055-diff-context.sh | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/config.c b/config.c
index 7330789..77407da 100644
--- a/config.c
+++ b/config.c
@@ -442,9 +442,9 @@ static int git_parse_source(config_fn_t fn, void *data)
break;
}
if (cf->die_on_error)
- die(_("bad config file line %d in %s"), cf->linenr, cf->name);
+ die(_("bad config variable '%s' at file line %d in %s"), var->buf, cf->linenr, cf->name);
else
- return error(_("bad config file line %d in %s"), cf->linenr, cf->name);
+ return error(_("bad config variable '%s' at file line %d in %s"), var->buf, cf->linenr, cf->name);
}
static int parse_unit_factor(const char *end, uintmax_t *val)
diff --git a/t/t4055-diff-context.sh b/t/t4055-diff-context.sh
index cd04543..741e080 100755
--- a/t/t4055-diff-context.sh
+++ b/t/t4055-diff-context.sh
@@ -79,7 +79,7 @@ test_expect_success 'non-integer config parsing' '
test_expect_success 'negative integer config parsing' '
git config diff.context -1 &&
test_must_fail git diff 2>output &&
- test_i18ngrep "bad config file" output
+ test_i18ngrep "bad config variable" output
'
test_expect_success '-U0 is valid, so is diff.context=0' '
--
1.9.0.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] config.c: mark error and warnings strings for translation
2014-07-31 13:42 [PATCH v2 1/2] config.c: mark error and warnings strings for translation Tanay Abhra
2014-07-31 13:42 ` [PATCH 2/2] add variable name to `git_config_*()` error message Tanay Abhra
@ 2014-07-31 13:50 ` Matthieu Moy
1 sibling, 0 replies; 4+ messages in thread
From: Matthieu Moy @ 2014-07-31 13:50 UTC (permalink / raw)
To: Tanay Abhra; +Cc: git, Ramkumar Ramachandra
Tanay Abhra <tanayabh@gmail.com> writes:
> From: Matthieu Moy <Matthieu.Moy@imag.fr>
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
> v2: error messages now start with a small letter.
Thanks. Ack on both patches.
Is there any reason not to include these two patches in the larger
series? (There's a semantic dependency on the changed error message and
test)
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-31 15:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-31 13:42 [PATCH v2 1/2] config.c: mark error and warnings strings for translation Tanay Abhra
2014-07-31 13:42 ` [PATCH 2/2] add variable name to `git_config_*()` error message Tanay Abhra
2014-07-31 15:23 ` Tanay Abhra
2014-07-31 13:50 ` [PATCH v2 1/2] config.c: mark error and warnings strings for translation Matthieu Moy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).