{"thread":{"id":"37262","subject":"[PATCH v2 1/2] config.c: mark error and warnings strings for translation","startedAt":"2014-07-31T13:42:05Z","lastAt":"2014-07-31T15:23:35Z","messageCount":4,"participants":["Tanay Abhra","Matthieu Moy"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"247049","messageId":"1406814126-10457-1-git-send-email-tanayabh@gmail.com","threadId":"37262","inReplyTo":null,"subject":"[PATCH v2 1/2] config.c: mark error and warnings strings for translation","fromName":"Tanay Abhra","fromEmail":"tanayabh@gmail.com","sentAt":"2014-07-31T13:42:05Z","receivedAt":"2014-07-31T13:42:05Z","isPatch":true,"sender":{"key":"tanayabh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2097229?v=4"},"body":"From: Matthieu Moy <Matthieu.Moy@imag.fr>\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nv2: error messages now start with a small letter.\n\n config.c | 20 ++++++++++----------\n 1 file changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex 058505c..7330789 100644\n--- a/config.c\n+++ b/config.c\n@@ -442,9 +442,9 @@ static int git_parse_source(config_fn_t fn, void *data)\n \t\t\tbreak;\n \t}\n \tif (cf->die_on_error)\n-\t\tdie(\"bad config file line %d in %s\", cf->linenr, cf->name);\n+\t\tdie(_(\"bad config file line %d in %s\"), cf->linenr, cf->name);\n \telse\n-\t\treturn error(\"bad config file line %d in %s\", cf->linenr, cf->name);\n+\t\treturn error(_(\"bad config file line %d in %s\"), cf->linenr, cf->name);\n }\n \n static int parse_unit_factor(const char *end, uintmax_t *val)\n@@ -560,9 +560,9 @@ static void die_bad_number(const char *name, const char *value)\n \t\tvalue = \"\";\n \n \tif (cf && cf->name)\n-\t\tdie(\"bad numeric config value '%s' for '%s' in %s: %s\",\n+\t\tdie(_(\"bad numeric config value '%s' for '%s' in %s: %s\"),\n \t\t    value, name, cf->name, reason);\n-\tdie(\"bad numeric config value '%s' for '%s': %s\", value, name, reason);\n+\tdie(_(\"bad numeric config value '%s' for '%s': %s\"), value, name, reason);\n }\n \n int git_config_int(const char *name, const char *value)\n@@ -647,7 +647,7 @@ int git_config_pathname(const char **dest, const char *var, const char *value)\n \t\treturn config_error_nonbool(var);\n \t*dest = expand_user_path(value);\n \tif (!*dest)\n-\t\tdie(\"Failed to expand user dir in: '%s'\", value);\n+\t\tdie(_(\"failed to expand user dir in: '%s'\"), value);\n \treturn 0;\n }\n \n@@ -725,7 +725,7 @@ static int git_default_core_config(const char *var, const char *value)\n \t\tif (level == -1)\n \t\t\tlevel = Z_DEFAULT_COMPRESSION;\n \t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n-\t\t\tdie(\"bad zlib compression level %d\", level);\n+\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n \t\tzlib_compression_level = level;\n \t\tzlib_compression_seen = 1;\n \t\treturn 0;\n@@ -736,7 +736,7 @@ static int git_default_core_config(const char *var, const char *value)\n \t\tif (level == -1)\n \t\t\tlevel = Z_DEFAULT_COMPRESSION;\n \t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n-\t\t\tdie(\"bad zlib compression level %d\", level);\n+\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n \t\tcore_compression_level = level;\n \t\tcore_compression_seen = 1;\n \t\tif (!zlib_compression_seen)\n@@ -858,7 +858,7 @@ static int git_default_core_config(const char *var, const char *value)\n \t\telse if (!strcmp(value, \"link\"))\n \t\t\tobject_creation_mode = OBJECT_CREATION_USES_HARDLINKS;\n \t\telse\n-\t\t\tdie(\"Invalid mode for object creation: %s\", value);\n+\t\t\tdie(_(\"invalid mode for object creation: %s\"), value);\n \t\treturn 0;\n \t}\n \n@@ -1158,7 +1158,7 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)\n \n \tswitch (git_config_from_parameters(fn, data)) {\n \tcase -1: /* error */\n-\t\tdie(\"unable to parse command-line config\");\n+\t\tdie(_(\"unable to parse command-line config\"));\n \t\tbreak;\n \tcase 0: /* found nothing */\n \t\tbreak;\n@@ -1243,7 +1243,7 @@ static int store_aux(const char *key, const char *value, void *cb)\n \tcase KEY_SEEN:\n \t\tif (matches(key, value)) {\n \t\t\tif (store.seen == 1 && store.multi_replace == 0) {\n-\t\t\t\twarning(\"%s has multiple values\", key);\n+\t\t\t\twarning(_(\"%s has multiple values\"), key);\n \t\t\t}\n \n \t\t\tALLOC_GROW(store.offset, store.seen + 1,\n-- \n1.9.0.GIT\n"},{"id":"247050","messageId":"1406814126-10457-2-git-send-email-tanayabh@gmail.com","threadId":"37262","inReplyTo":"1406814126-10457-1-git-send-email-tanayabh@gmail.com","subject":"[PATCH 2/2] add variable name to `git_config_*()` error message","fromName":"Tanay Abhra","fromEmail":"tanayabh@gmail.com","sentAt":"2014-07-31T13:42:06Z","receivedAt":"2014-07-31T13:42:06Z","isPatch":true,"sender":{"key":"tanayabh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2097229?v=4"},"body":"Whenever a callback returns a negative value, the functions\nof `git_config_*()` family die printing the line number and\nfile name. In addition to them, add the variable name to the\nerror message.\n\nSigned-off-by: Tanay Abhra <tanayabh@gmail.com>\n---\n config.c                | 4 ++--\n t/t4055-diff-context.sh | 2 +-\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex 7330789..77407da 100644\n--- a/config.c\n+++ b/config.c\n@@ -442,9 +442,9 @@ static int git_parse_source(config_fn_t fn, void *data)\n \t\t\tbreak;\n \t}\n \tif (cf->die_on_error)\n-\t\tdie(_(\"bad config file line %d in %s\"), cf->linenr, cf->name);\n+\t\tdie(_(\"bad config variable '%s' at file line %d in %s\"), var->buf, cf->linenr, cf->name);\n \telse\n-\t\treturn error(_(\"bad config file line %d in %s\"), cf->linenr, cf->name);\n+\t\treturn error(_(\"bad config variable '%s' at file line %d in %s\"), var->buf, cf->linenr, cf->name);\n }\n \n static int parse_unit_factor(const char *end, uintmax_t *val)\ndiff --git a/t/t4055-diff-context.sh b/t/t4055-diff-context.sh\nindex cd04543..741e080 100755\n--- a/t/t4055-diff-context.sh\n+++ b/t/t4055-diff-context.sh\n@@ -79,7 +79,7 @@ test_expect_success 'non-integer config parsing' '\n test_expect_success 'negative integer config parsing' '\n \tgit config diff.context -1 &&\n \ttest_must_fail git diff 2>output &&\n-\ttest_i18ngrep \"bad config file\" output\n+\ttest_i18ngrep \"bad config variable\" output\n '\n \n test_expect_success '-U0 is valid, so is diff.context=0' '\n-- \n1.9.0.GIT\n"},{"id":"247051","messageId":"vpq8un9ljr7.fsf@anie.imag.fr","threadId":"37262","inReplyTo":"1406814126-10457-1-git-send-email-tanayabh@gmail.com","subject":"Re: [PATCH v2 1/2] config.c: mark error and warnings strings for translation","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2014-07-31T13:50:52Z","receivedAt":"2014-07-31T13:50:52Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Tanay Abhra <tanayabh@gmail.com> writes:\n\n> From: Matthieu Moy <Matthieu.Moy@imag.fr>\n>\n> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n> ---\n> v2: error messages now start with a small letter.\n\nThanks. Ack on both patches.\n\nIs there any reason not to include these two patches in the larger\nseries? (There's a semantic dependency on the changed error message and\ntest)\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"247053","messageId":"53DA5F77.8020106@gmail.com","threadId":"37262","inReplyTo":"1406814126-10457-2-git-send-email-tanayabh@gmail.com","subject":"Re: [PATCH 2/2] add variable name to `git_config_*()` error message","fromName":"Tanay Abhra","fromEmail":"tanayabh@gmail.com","sentAt":"2014-07-31T15:23:35Z","receivedAt":"2014-07-31T15:23:35Z","isPatch":true,"sender":{"key":"tanayabh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2097229?v=4"},"body":"Junio, drop (2/2) of this series, it has conflicts with ta/config-set in pu.\nThis patch can easily come later. Sorry for the inconvenience.\n\nPatch 1/2 is OK.\n\nThanks.\n"}]}