{"thread":{"id":"47611","subject":"[PATCH 0/1] Marked end user messages for translation","startedAt":"2018-01-15T05:44:48Z","lastAt":"2018-02-13T13:19:33Z","messageCount":20,"participants":["Alexander Shopov","Johannes Sixt","Eric Sunshine","Duy Nguyen","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"336601","messageId":"20180115054419.4112-1-ash@kambanaria.org","threadId":"47611","inReplyTo":null,"subject":"[PATCH 0/1] Marked end user messages for translation","fromName":"Alexander Shopov","fromEmail":"ash@kambanaria.org","sentAt":"2018-01-15T05:44:18Z","receivedAt":"2018-01-15T05:44:48Z","isPatch":true,"sender":{"key":"ash@kambanaria.org","avatar":"https://avatars.githubusercontent.com/u/449359?v=4"},"body":"I have marked several messages for translations in git.c and setup.c\nThey pop from time to time on normal usage of git.\nThe messages are aimed at end users and may help them solve issues.\nI have tried to keep the C formatting conventions in the two files.\nI have also reused messages which provides uniformity of the used\nverb tense and will ease the work of translators.\n\nAlexander Shopov (1):\n  Mark messages for translations\n\n git.c   | 30 +++++++++++++++---------------\n setup.c | 52 ++++++++++++++++++++++++++--------------------------\n 2 files changed, 41 insertions(+), 41 deletions(-)\n\n-- \n2.15.1\n\n"},{"id":"336602","messageId":"20180115054419.4112-2-ash@kambanaria.org","threadId":"47611","inReplyTo":"20180115054419.4112-1-ash@kambanaria.org","subject":"[PATCH 1/1] Mark messages for translations","fromName":"Alexander Shopov","fromEmail":"ash@kambanaria.org","sentAt":"2018-01-15T05:44:19Z","receivedAt":"2018-01-15T05:44:50Z","isPatch":true,"sender":{"key":"ash@kambanaria.org","avatar":"https://avatars.githubusercontent.com/u/449359?v=4"},"body":"Reuse already translated messages if possible\nDo not translate messages aimed at developers of git\n\nSigned-off-by: Alexander Shopov <ash@kambanaria.org>\n---\n git.c   | 30 +++++++++++++++---------------\n setup.c | 52 ++++++++++++++++++++++++++--------------------------\n 2 files changed, 41 insertions(+), 41 deletions(-)\n\ndiff --git a/git.c b/git.c\nindex c870b9719..e66316ce5 100644\n--- a/git.c\n+++ b/git.c\n@@ -5,11 +5,11 @@\n #include \"run-command.h\"\n \n const char git_usage_string[] =\n-\t\"git [--version] [--help] [-C <path>] [-c name=value]\\n\"\n-\t\"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\\n\"\n-\t\"           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\\n\"\n-\t\"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\\n\"\n-\t\"           <command> [<args>]\";\n+\tN_(\"git [--version] [--help] [-C <path>] [-c name=value]\\n\"\n+\t   \"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\\n\"\n+\t   \"           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\\n\"\n+\t   \"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\\n\"\n+\t   \"           <command> [<args>]\");\n \n const char git_more_info_string[] =\n \tN_(\"'git help -a' and 'git help -g' list available subcommands and some\\n\"\n@@ -92,7 +92,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--git-dir\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No directory given for --git-dir.\\n\" );\n+  \t\t\t\tfprintf(stderr, _(\"No directory given for --git-dir.\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_DIR_ENVIRONMENT, (*argv)[1], 1);\n@@ -106,7 +106,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--namespace\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No namespace given for --namespace.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"No namespace given for --namespace.\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_NAMESPACE_ENVIRONMENT, (*argv)[1], 1);\n@@ -120,7 +120,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--work-tree\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No directory given for --work-tree.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"No directory given for --work-tree.\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_WORK_TREE_ENVIRONMENT, (*argv)[1], 1);\n@@ -134,7 +134,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--super-prefix\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No prefix given for --super-prefix.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"No prefix given for --super-prefix.\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_SUPER_PREFIX_ENVIRONMENT, (*argv)[1], 1);\n@@ -156,7 +156,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"-c\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"-c expects a configuration string\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"-c expects a configuration string\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tgit_config_push_parameter((*argv)[1]);\n@@ -194,7 +194,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"-C\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No directory given for -C.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"No directory given for -C.\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tif ((*argv)[1][0]) {\n@@ -209,7 +209,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\tlist_builtins();\n \t\t\texit(0);\n \t\t} else {\n-\t\t\tfprintf(stderr, \"Unknown option: %s\\n\", cmd);\n+\t\t\tfprintf(stderr, _(\"Unknown option: %s\\n\"), cmd);\n \t\t\tusage(git_usage_string);\n \t\t}\n \n@@ -684,8 +684,8 @@ int cmd_main(int argc, const char **argv)\n \t\tif (errno != ENOENT)\n \t\t\tbreak;\n \t\tif (was_alias) {\n-\t\t\tfprintf(stderr, \"Expansion of alias '%s' failed; \"\n-\t\t\t\t\"'%s' is not a git command\\n\",\n+\t\t\tfprintf(stderr, _(\"Expansion of alias '%s' failed; \"\n+\t\t\t\t\t  \"'%s' is not a git command\\n\"),\n \t\t\t\tcmd, argv[0]);\n \t\t\texit(1);\n \t\t}\n@@ -696,7 +696,7 @@ int cmd_main(int argc, const char **argv)\n \t\t\tbreak;\n \t}\n \n-\tfprintf(stderr, \"Failed to run command '%s': %s\\n\",\n+\tfprintf(stderr, _(\"Failed to run command '%s': %s\\n\"),\n \t\tcmd, strerror(errno));\n \n \treturn 1;\ndiff --git a/setup.c b/setup.c\nindex 8cc34186c..4aa8c8360 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -119,7 +119,7 @@ char *prefix_path(const char *prefix, int len, const char *path)\n {\n \tchar *r = prefix_path_gently(prefix, len, NULL, path);\n \tif (!r)\n-\t\tdie(\"'%s' is outside repository\", path);\n+\t\tdie(_(\"'%s' is outside repository\"), path);\n \treturn r;\n }\n \n@@ -160,7 +160,7 @@ int check_filename(const char *prefix, const char *arg)\n \t\tfree(to_free);\n \t\treturn 0; /* file does not exist */\n \t}\n-\tdie_errno(\"failed to stat '%s'\", arg);\n+\tdie_errno(_(\"failed to stat '%s'\", arg));\n }\n \n static void NORETURN die_verify_filename(const char *prefix,\n@@ -230,7 +230,7 @@ void verify_filename(const char *prefix,\n \t\t     int diagnose_misspelt_rev)\n {\n \tif (*arg == '-')\n-\t\tdie(\"option '%s' must come before non-option arguments\", arg);\n+\t\tdie(_(\"option '%s' must come before non-option arguments\"), arg);\n \tif (looks_like_pathspec(arg) || check_filename(prefix, arg))\n \t\treturn;\n \tdie_verify_filename(prefix, arg, diagnose_misspelt_rev);\n@@ -385,14 +385,14 @@ void setup_work_tree(void)\n \t\treturn;\n \n \tif (work_tree_config_is_bogus)\n-\t\tdie(\"unable to set up work tree using invalid config\");\n+\t\tdie(_(\"unable to set up work tree using invalid config\"));\n \n \twork_tree = get_git_work_tree();\n \tgit_dir = get_git_dir();\n \tif (!is_absolute_path(git_dir))\n \t\tgit_dir = real_path(get_git_dir());\n \tif (!work_tree || chdir(work_tree))\n-\t\tdie(\"This operation must be run in a work tree\");\n+\t\tdie(_(\"This operation must be run in a work tree\"));\n \n \t/*\n \t * Make sure subsequent git processes find correct worktree\n@@ -525,19 +525,19 @@ void read_gitfile_error_die(int error_code, const char *path, const char *dir)\n \t\t/* non-fatal; follow return path */\n \t\tbreak;\n \tcase READ_GITFILE_ERR_OPEN_FAILED:\n-\t\tdie_errno(\"Error opening '%s'\", path);\n+\t\tdie_errno(_(\"Error opening '%s'\"), path);\n \tcase READ_GITFILE_ERR_TOO_LARGE:\n-\t\tdie(\"Too large to be a .git file: '%s'\", path);\n+\t\tdie(_(\"Too large to be a .git file: '%s'\"), path);\n \tcase READ_GITFILE_ERR_READ_FAILED:\n-\t\tdie(\"Error reading %s\", path);\n+\t\tdie(_(\"Error reading %s\"), path);\n \tcase READ_GITFILE_ERR_INVALID_FORMAT:\n-\t\tdie(\"Invalid gitfile format: %s\", path);\n+\t\tdie(_(\"Invalid gitfile format: %s\"), path);\n \tcase READ_GITFILE_ERR_NO_PATH:\n-\t\tdie(\"No path in gitfile: %s\", path);\n+\t\tdie(_(\"No path in gitfile: %s\"), path);\n \tcase READ_GITFILE_ERR_NOT_A_REPO:\n-\t\tdie(\"Not a git repository: %s\", dir);\n+\t\tdie(_(\"Not a git repository: %s\"), dir);\n \tdefault:\n-\t\tdie(\"BUG: unknown error code\");\n+\t\tdie(_(\"BUG: unknown error code\"));\n \t}\n }\n \n@@ -634,7 +634,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \tint offset;\n \n \tif (PATH_MAX - 40 < strlen(gitdirenv))\n-\t\tdie(\"'$%s' too big\", GIT_DIR_ENVIRONMENT);\n+\t\tdie(_(\"'$%s' too big\"), GIT_DIR_ENVIRONMENT);\n \n \tgitfile = (char*)read_gitfile(gitdirenv);\n \tif (gitfile) {\n@@ -648,7 +648,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \t\t\tfree(gitfile);\n \t\t\treturn NULL;\n \t\t}\n-\t\tdie(\"Not a git repository: '%s'\", gitdirenv);\n+\t\tdie(_(\"Not a git repository: '%s'\"), gitdirenv);\n \t}\n \n \tif (check_repository_format_gently(gitdirenv, repo_fmt, nongit_ok)) {\n@@ -677,12 +677,12 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \t\telse {\n \t\t\tchar *core_worktree;\n \t\t\tif (chdir(gitdirenv))\n-\t\t\t\tdie_errno(\"Could not chdir to '%s'\", gitdirenv);\n+\t\t\t\tdie_errno(_(\"Cannot chdir to '%s'\"), gitdirenv);\n \t\t\tif (chdir(git_work_tree_cfg))\n-\t\t\t\tdie_errno(\"Could not chdir to '%s'\", git_work_tree_cfg);\n+\t\t\t\tdie_errno(_(\"Cannot chdir to '%s'\"), git_work_tree_cfg);\n \t\t\tcore_worktree = xgetcwd();\n \t\t\tif (chdir(cwd->buf))\n-\t\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\t\tdie_errno(_(\"Cannot come back to cwd\");\n \t\t\tset_git_work_tree(core_worktree);\n \t\t\tfree(core_worktree);\n \t\t}\n@@ -710,7 +710,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \tif (offset >= 0) {\t/* cwd inside worktree? */\n \t\tset_git_dir(real_path(gitdirenv));\n \t\tif (chdir(worktree))\n-\t\t\tdie_errno(\"Could not chdir to '%s'\", worktree);\n+\t\t\tdie_errno(_(\"Cannot chdir to '%s'\"), worktree);\n \t\tstrbuf_addch(cwd, '/');\n \t\tfree(gitfile);\n \t\treturn cwd->buf + offset;\n@@ -738,7 +738,7 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n \t\tif (offset != cwd->len && !is_absolute_path(gitdir))\n \t\t\tgitdir = to_free = real_pathdup(gitdir, 1);\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tdie_errno(_(\"Cannot come back to cwd\"));\n \t\tret = setup_explicit_git_dir(gitdir, cwd, repo_fmt, nongit_ok);\n \t\tfree(to_free);\n \t\treturn ret;\n@@ -748,7 +748,7 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n \tif (is_bare_repository_cfg > 0) {\n \t\tset_git_dir(offset == cwd->len ? gitdir : real_path(gitdir));\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tdie_errno(_(\"Cannot come back to cwd\"));\n \t\treturn NULL;\n \t}\n \n@@ -787,7 +787,7 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,\n \n \t\tgitdir = offset == cwd->len ? \".\" : xmemdupz(cwd->buf, offset);\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tdie_errno(_(\"Cannot come back to cwd\"));\n \t\treturn setup_explicit_git_dir(gitdir, cwd, repo_fmt, nongit_ok);\n \t}\n \n@@ -795,7 +795,7 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,\n \tinside_work_tree = 0;\n \tif (offset != cwd->len) {\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Cannot come back to cwd\");\n+\t\t\tdie_errno(_(\"Cannot come back to cwd\"));\n \t\troot_len = offset_1st_component(cwd->buf);\n \t\tstrbuf_setlen(cwd, offset > root_len ? offset : root_len);\n \t\tset_git_dir(cwd->buf);\n@@ -819,7 +819,7 @@ static dev_t get_device_or_die(const char *path, const char *prefix, int prefix_\n {\n \tstruct stat buf;\n \tif (stat(path, &buf)) {\n-\t\tdie_errno(\"failed to stat '%*s%s%s'\",\n+\t\tdie_errno(_(\"failed to stat '%*s%s%s'\"),\n \t\t\t\tprefix_len,\n \t\t\t\tprefix ? prefix : \"\",\n \t\t\t\tprefix ? \"/\" : \"\", path);\n@@ -1207,7 +1207,7 @@ void sanitize_stdfds(void)\n \twhile (fd != -1 && fd < 2)\n \t\tfd = dup(fd);\n \tif (fd == -1)\n-\t\tdie_errno(\"open /dev/null or dup failed\");\n+\t\tdie_errno(_(\"open /dev/null or dup failed\"));\n \tif (fd > 2)\n \t\tclose(fd);\n }\n@@ -1222,12 +1222,12 @@ int daemonize(void)\n \t\tcase 0:\n \t\t\tbreak;\n \t\tcase -1:\n-\t\t\tdie_errno(\"fork failed\");\n+\t\t\tdie_errno(_(\"fork failed\"));\n \t\tdefault:\n \t\t\texit(0);\n \t}\n \tif (setsid() == -1)\n-\t\tdie_errno(\"setsid failed\");\n+\t\tdie_errno(_(\"setsid failed\"));\n \tclose(0);\n \tclose(1);\n \tclose(2);\n-- \n2.15.1\n\n"},{"id":"336605","messageId":"b9e734a2-52bb-08b1-6bab-3d47b0f7ebeb@kdbg.org","threadId":"47611","inReplyTo":"20180115054419.4112-2-ash@kambanaria.org","subject":"Re: [PATCH 1/1] Mark messages for translations","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2018-01-15T07:33:56Z","receivedAt":"2018-01-15T07:34:02Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 15.01.2018 um 06:44 schrieb Alexander Shopov:\n> @@ -5,11 +5,11 @@\n>   #include \"run-command.h\"\n>   \n>   const char git_usage_string[] =\n> -\t\"git [--version] [--help] [-C <path>] [-c name=value]\\n\"\n> -\t\"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\\n\"\n> -\t\"           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\\n\"\n> -\t\"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\\n\"\n> -\t\"           <command> [<args>]\";\n> +\tN_(\"git [--version] [--help] [-C <path>] [-c name=value]\\n\"\n> +\t   \"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\\n\"\n> +\t   \"           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\\n\"\n> +\t   \"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\\n\"\n> +\t   \"           <command> [<args>]\");\n>   \n>   const char git_more_info_string[] =\n>   \tN_(\"'git help -a' and 'git help -g' list available subcommands and some\\n\"\n> @@ -92,7 +92,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n>   \t\t\t\t*envchanged = 1;\n>   \t\t} else if (!strcmp(cmd, \"--git-dir\")) {\n>   \t\t\tif (*argc < 2) {\n> -\t\t\t\tfprintf(stderr, \"No directory given for --git-dir.\\n\" );\n> +  \t\t\t\tfprintf(stderr, _(\"No directory given for --git-dir.\\n\" ));\n>   \t\t\t\tusage(git_usage_string);\n\nIt is not obvious to me where git_usage_string is looked up in the \nmessage catalog. Should this not be\n\n\t\t\t\tusage(_(git_usage_string));\n\n(here and in later instances)? It is used that way in builtin/help.c, \nfor example.\n\n> @@ -385,14 +385,14 @@ void setup_work_tree(void)\n>   \t\treturn;\n>   \n>   \tif (work_tree_config_is_bogus)\n> -\t\tdie(\"unable to set up work tree using invalid config\");\n> +\t\tdie(_(\"unable to set up work tree using invalid config\"));\n>   \n>   \twork_tree = get_git_work_tree();\n>   \tgit_dir = get_git_dir();\n>   \tif (!is_absolute_path(git_dir))\n>   \t\tgit_dir = real_path(get_git_dir());\n>   \tif (!work_tree || chdir(work_tree))\n> -\t\tdie(\"This operation must be run in a work tree\");\n> +\t\tdie(_(\"This operation must be run in a work tree\"));\n\nWe have settled with lower-case letters at the beginning of error \nmessages. (See Documentation/CodingGuidelines, \"Error Messages\".) You \ncould fix that while you are touching die, die_errno, etc, messages.\n\n> @@ -677,12 +677,12 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n>   \t\telse {\n>   \t\t\tchar *core_worktree;\n>   \t\t\tif (chdir(gitdirenv))\n> -\t\t\t\tdie_errno(\"Could not chdir to '%s'\", gitdirenv);\n> +\t\t\t\tdie_errno(_(\"Cannot chdir to '%s'\"), gitdirenv);\n\nI notice you change past tense to present tense in some cases. IMO, this \nmakes the messages more consistent. Good.\n\nI'm not a friend of geeky abbreviations like \"chdir\" or \"cwd\" in \nuser-visible messages, and I would have taken the opportunity to change \nthe messages accordingly. This is really only my personal taste, though, \nand it's possible that I'm alone in this camp.\n\n>   \t\t\tif (chdir(git_work_tree_cfg))\n> -\t\t\t\tdie_errno(\"Could not chdir to '%s'\", git_work_tree_cfg);\n> +\t\t\t\tdie_errno(_(\"Cannot chdir to '%s'\"), git_work_tree_cfg);\n>   \t\t\tcore_worktree = xgetcwd();\n>   \t\t\tif (chdir(cwd->buf))\n> -\t\t\t\tdie_errno(\"Could not come back to cwd\");\n> +\t\t\t\tdie_errno(_(\"Cannot come back to cwd\");\n...\n> @@ -1207,7 +1207,7 @@ void sanitize_stdfds(void)\n>   \twhile (fd != -1 && fd < 2)\n>   \t\tfd = dup(fd);\n>   \tif (fd == -1)\n> -\t\tdie_errno(\"open /dev/null or dup failed\");\n> +\t\tdie_errno(_(\"open /dev/null or dup failed\"));\n>   \tif (fd > 2)\n>   \t\tclose(fd);\n>   }\n> @@ -1222,12 +1222,12 @@ int daemonize(void)\n>   \t\tcase 0:\n>   \t\t\tbreak;\n>   \t\tcase -1:\n> -\t\t\tdie_errno(\"fork failed\");\n> +\t\t\tdie_errno(_(\"fork failed\"));\n>   \t\tdefault:\n>   \t\t\texit(0);\n>   \t}\n>   \tif (setsid() == -1)\n> -\t\tdie_errno(\"setsid failed\");\n> +\t\tdie_errno(_(\"setsid failed\"));\n\nHere is a certain class of errors: They should occur only rarely \n(actually, is that true?) Then it is useful to have the function name in \nthe message. Which rises the question: why translate them at all? It's \npossible that translators turn the message into unusable gibberish just \nto please their language. All of this is only IMHO; I don't use \ntranslated Git.\n\n-- Hannes\n"},{"id":"336606","messageId":"CAP6f5M=HdjfQT+oO76sMfcD7zOfajeukh_VxSL_diqEsCWAYWw@mail.gmail.com","threadId":"47611","inReplyTo":"CAP6f5MnaMiqEMbGW_xj6X495jF=txpzeq+DEHOkz7VCg2D6D9w@mail.gmail.com","subject":"Re: [PATCH 1/1] Mark messages for translations","fromName":"Alexander Shopov","fromEmail":"ash@kambanaria.org","sentAt":"2018-01-15T09:16:27Z","receivedAt":"2018-01-15T09:16:38Z","isPatch":true,"sender":{"key":"ash@kambanaria.org","avatar":"https://avatars.githubusercontent.com/u/449359?v=4"},"body":"And again, sigh:\n>>   const char git_usage_string[] =\n....\n>>   const char git_more_info_string[] =\n> It is not obvious to me where git_usage_string is looked up in the\n> message catalog. It is used that way in builtin/help.c ..\n\nI wanted to be consistent with the current state of the file. This is the\nsame way const char git_more_info_string[] is defined and initialized.\nHaving it this way saves the lookup on each usage I guess but any performance\ngains will be negligible. Is there a convention?\n\n> We have settled with lower-case letters at the beginning of error\n> messages. (See Documentation/CodingGuidelines, \"Error Messages\".) You\n> could fix that while you are touching die, die_errno, etc, messages.\n\nGreat! It will allow for further reduction in repetition of messages.\n\n> I notice you change past tense to present tense in some cases.\nI am reading this that messages SHOULD be in present tense (unless they MUST\nbe in past tense). This is good. Perhaps I will look at current messages and\nthen fix en masse (if there is sth to fix).\n\n> I'm not a friend of geeky abbreviations like \"chdir\" or \"cwd\" in\n> user-visible messages\n\nI agree but I would also keep in mind that using the name of the function\nmay alllow to parametrize the messages like:\nCannot execute \"%s\" on \"%s\" - for example. Anyway this is not that important\nfor me. Will wait for other opinions.\n\n>> -                     die_errno(\"fork failed\");\n>> +                     die_errno(_(\"fork failed\"));\n>> -             die_errno(\"setsid failed\");\n>> +             die_errno(_(\"setsid failed\"));\n\n> it is useful to have the function name in  the message. Which rises the\n> question:why translate them at all?\nWhy not eat the cake while having it - one can pass function name in  a\n message like: '\"%s\" failed'\n\nRegards:\nal_shopov\n"},{"id":"336607","messageId":"CAPig+cTm=bNqncS63DmN6Qi7GGkXcPv-wnKfNe=btgSM9YTPYg@mail.gmail.com","threadId":"47611","inReplyTo":"20180115054419.4112-2-ash@kambanaria.org","subject":"Re: [PATCH 1/1] Mark messages for translations","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-01-15T09:58:29Z","receivedAt":"2018-01-15T09:58:43Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Mon, Jan 15, 2018 at 12:44 AM, Alexander Shopov <ash@kambanaria.org> wrote:\n> Reuse already translated messages if possible\n> Do not translate messages aimed at developers of git\n\nA couple comments beyond those from Hannes...\n\n> Signed-off-by: Alexander Shopov <ash@kambanaria.org>\n> ---\n> diff --git a/git.c b/git.c\n> @@ -5,11 +5,11 @@\n>  const char git_usage_string[] =\n> +       N_(\"git [--version] [--help] [-C <path>] [-c name=value]\\n\"\n\nSince you're touching this, perhaps take the opportunity to fix `-c\nname=value` to say `-c <name>=<value>`?\n\n> +          \"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\\n\"\n> +          \"           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\\n\"\n> +          \"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\\n\"\n> +          \"           <command> [<args>]\");\n> diff --git a/setup.c b/setup.c\n> @@ -525,19 +525,19 @@ void read_gitfile_error_die(int error_code, const char *path, const char *dir)\n>         case READ_GITFILE_ERR_NOT_A_REPO:\n> -               die(\"Not a git repository: %s\", dir);\n> +               die(_(\"Not a git repository: %s\"), dir);\n>         default:\n> -               die(\"BUG: unknown error code\");\n> +               die(_(\"BUG: unknown error code\"));\n\nThis last one is aimed at developers (indeed, \"BUG\" message should\nnever been seen by end-users). I'd leave it untranslated.\n\n>         }\n>  }\n"},{"id":"336608","messageId":"CACsJy8B4zfu4q-KPEWZp=5cGRmpfhK75D41MB_SX_kU0LNgQUA@mail.gmail.com","threadId":"47611","inReplyTo":"20180115054419.4112-2-ash@kambanaria.org","subject":"Re: [PATCH 1/1] Mark messages for translations","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-01-15T10:21:56Z","receivedAt":"2018-01-15T10:22:33Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Mon, Jan 15, 2018 at 12:44 PM, Alexander Shopov <ash@kambanaria.org> wrote:\n> @@ -160,7 +160,7 @@ int check_filename(const char *prefix, const char *arg)\n>                 free(to_free);\n>                 return 0; /* file does not exist */\n>         }\n> -       die_errno(\"failed to stat '%s'\", arg);\n> +       die_errno(_(\"failed to stat '%s'\", arg));\n>  }\n\nThe new \")\" is at a wrong place. It should be %s'\"), arg); not %s'\", arg));\n-- \nDuy\n"},{"id":"338481","messageId":"20180206061537.2573-1-ash@kambanaria.org","threadId":"47611","inReplyTo":"20180115054419.4112-1-ash@kambanaria.org","subject":"[PATCH 0/1] Mark messages for translations","fromName":"Alexander Shopov","fromEmail":"ash@kambanaria.org","sentAt":"2018-02-06T06:15:36Z","receivedAt":"2018-02-06T06:15:49Z","isPatch":true,"sender":{"key":"ash@kambanaria.org","avatar":"https://avatars.githubusercontent.com/u/449359?v=4"},"body":"*** BLURB HERE ***\nHi all,\n\nAgain I am marking messages for translations in gui.c and setup.c based\non the feedback I got last time. Now I am fixing unit tests as well,\nhopefully no regressions.\n\nHere is a recap:\n\nJohannes Sixt:\n  1. Lower-case letters at the beginning of error messages\n  2. Past tense to present tense in some cases\nEric Sunshine:\n  3. Fix `-cname=value` to say `-c <name>=<value>`\n  4. Do not translate \"BUG message\"\nDuy Nguyen:\n  5. Fix parentheses on `_` macro\n\nKind regards:\nal_shopov\n\n\nAlexander Shopov (1):\n  Mark messages for translations\n\n git.c              | 38 ++++++++++++++++-----------------\n setup.c            | 62 +++++++++++++++++++++++++++---------------------------\n t/t0002-gitfile.sh |  4 ++--\n t/t0008-ignores.sh |  2 +-\n 4 files changed, 53 insertions(+), 53 deletions(-)\n\n-- \n2.16.1\n\n"},{"id":"338482","messageId":"20180206061537.2573-2-ash@kambanaria.org","threadId":"47611","inReplyTo":"20180206061537.2573-1-ash@kambanaria.org","subject":"[PATCH 1/1] Mark messages for translations","fromName":"Alexander Shopov","fromEmail":"ash@kambanaria.org","sentAt":"2018-02-06T06:15:37Z","receivedAt":"2018-02-06T06:15:53Z","isPatch":true,"sender":{"key":"ash@kambanaria.org","avatar":"https://avatars.githubusercontent.com/u/449359?v=4"},"body":"Small changes in messages to fit the style and typography of rest\nReuse already translated messages if possible\nDo not translate messages aimed at developers of git\nFix unit tests depending on the original string\n\nSigned-off-by: Alexander Shopov <ash@kambanaria.org>\n---\n git.c              | 38 ++++++++++++++++-----------------\n setup.c            | 62 +++++++++++++++++++++++++++---------------------------\n t/t0002-gitfile.sh |  4 ++--\n t/t0008-ignores.sh |  2 +-\n 4 files changed, 53 insertions(+), 53 deletions(-)\n\ndiff --git a/git.c b/git.c\nindex c870b9719..5ddcb75d4 100644\n--- a/git.c\n+++ b/git.c\n@@ -5,11 +5,11 @@\n #include \"run-command.h\"\n \n const char git_usage_string[] =\n-\t\"git [--version] [--help] [-C <path>] [-c name=value]\\n\"\n-\t\"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\\n\"\n-\t\"           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\\n\"\n-\t\"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\\n\"\n-\t\"           <command> [<args>]\";\n+\tN_(\"git [--version] [--help] [-C <path>] [-c <name>=<value>]\\n\"\n+\t   \"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\\n\"\n+\t   \"           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\\n\"\n+\t   \"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\\n\"\n+\t   \"           <command> [<args>]\");\n \n const char git_more_info_string[] =\n \tN_(\"'git help -a' and 'git help -g' list available subcommands and some\\n\"\n@@ -92,7 +92,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--git-dir\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No directory given for --git-dir.\\n\" );\n+  \t\t\t\tfprintf(stderr, _(\"no directory given for --git-dir\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_DIR_ENVIRONMENT, (*argv)[1], 1);\n@@ -106,7 +106,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--namespace\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No namespace given for --namespace.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"no namespace given for --namespace\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_NAMESPACE_ENVIRONMENT, (*argv)[1], 1);\n@@ -120,7 +120,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--work-tree\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No directory given for --work-tree.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"no directory given for --work-tree\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_WORK_TREE_ENVIRONMENT, (*argv)[1], 1);\n@@ -134,7 +134,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--super-prefix\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No prefix given for --super-prefix.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"no prefix given for --super-prefix\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_SUPER_PREFIX_ENVIRONMENT, (*argv)[1], 1);\n@@ -156,7 +156,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"-c\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"-c expects a configuration string\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"-c expects a configuration string\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tgit_config_push_parameter((*argv)[1]);\n@@ -194,12 +194,12 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"-C\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No directory given for -C.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"no directory given for -C\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tif ((*argv)[1][0]) {\n \t\t\t\tif (chdir((*argv)[1]))\n-\t\t\t\t\tdie_errno(\"Cannot change to '%s'\", (*argv)[1]);\n+\t\t\t\t\tdie_errno(\"cannot change to '%s'\", (*argv)[1]);\n \t\t\t\tif (envchanged)\n \t\t\t\t\t*envchanged = 1;\n \t\t\t}\n@@ -209,7 +209,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\tlist_builtins();\n \t\t\texit(0);\n \t\t} else {\n-\t\t\tfprintf(stderr, \"Unknown option: %s\\n\", cmd);\n+\t\t\tfprintf(stderr, _(\"unknown option: %s\\n\"), cmd);\n \t\t\tusage(git_usage_string);\n \t\t}\n \n@@ -247,7 +247,7 @@ static int handle_alias(int *argcp, const char ***argv)\n \t\t\tif (ret >= 0)   /* normal exit */\n \t\t\t\texit(ret);\n \n-\t\t\tdie_errno(\"While expanding alias '%s': '%s'\",\n+\t\t\tdie_errno(\"while expanding alias '%s': '%s'\",\n \t\t\t    alias_command, alias_string + 1);\n \t\t}\n \t\tcount = split_cmdline(alias_string, &new_argv);\n@@ -256,8 +256,8 @@ static int handle_alias(int *argcp, const char ***argv)\n \t\t\t    split_cmdline_strerror(count));\n \t\toption_count = handle_options(&new_argv, &count, &envchanged);\n \t\tif (envchanged)\n-\t\t\tdie(\"alias '%s' changes environment variables\\n\"\n-\t\t\t\t \"You can use '!git' in the alias to do this.\",\n+\t\t\tdie(\"alias '%s' changes environment variables.\\n\"\n+\t\t\t\t \"You can use '!git' in the alias to do this\",\n \t\t\t\t alias_command);\n \t\tmemmove(new_argv - option_count, new_argv,\n \t\t\t\tcount * sizeof(char *));\n@@ -684,8 +684,8 @@ int cmd_main(int argc, const char **argv)\n \t\tif (errno != ENOENT)\n \t\t\tbreak;\n \t\tif (was_alias) {\n-\t\t\tfprintf(stderr, \"Expansion of alias '%s' failed; \"\n-\t\t\t\t\"'%s' is not a git command\\n\",\n+\t\t\tfprintf(stderr, _(\"expansion of alias '%s' failed; \"\n+\t\t\t\t\t  \"'%s' is not a git command\\n\"),\n \t\t\t\tcmd, argv[0]);\n \t\t\texit(1);\n \t\t}\n@@ -696,7 +696,7 @@ int cmd_main(int argc, const char **argv)\n \t\t\tbreak;\n \t}\n \n-\tfprintf(stderr, \"Failed to run command '%s': %s\\n\",\n+\tfprintf(stderr, _(\"failed to run command '%s': %s\\n\"),\n \t\tcmd, strerror(errno));\n \n \treturn 1;\ndiff --git a/setup.c b/setup.c\nindex 8cc34186c..30894cec9 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -119,7 +119,7 @@ char *prefix_path(const char *prefix, int len, const char *path)\n {\n \tchar *r = prefix_path_gently(prefix, len, NULL, path);\n \tif (!r)\n-\t\tdie(\"'%s' is outside repository\", path);\n+\t\tdie(_(\"'%s' is outside repository\"), path);\n \treturn r;\n }\n \n@@ -160,7 +160,7 @@ int check_filename(const char *prefix, const char *arg)\n \t\tfree(to_free);\n \t\treturn 0; /* file does not exist */\n \t}\n-\tdie_errno(\"failed to stat '%s'\", arg);\n+\tdie_errno(_(\"failed to stat '%s'\"), arg);\n }\n \n static void NORETURN die_verify_filename(const char *prefix,\n@@ -230,7 +230,7 @@ void verify_filename(const char *prefix,\n \t\t     int diagnose_misspelt_rev)\n {\n \tif (*arg == '-')\n-\t\tdie(\"option '%s' must come before non-option arguments\", arg);\n+\t\tdie(_(\"option '%s' must come before non-option arguments\"), arg);\n \tif (looks_like_pathspec(arg) || check_filename(prefix, arg))\n \t\treturn;\n \tdie_verify_filename(prefix, arg, diagnose_misspelt_rev);\n@@ -385,14 +385,14 @@ void setup_work_tree(void)\n \t\treturn;\n \n \tif (work_tree_config_is_bogus)\n-\t\tdie(\"unable to set up work tree using invalid config\");\n+\t\tdie(_(\"unable to set up work tree using invalid config\"));\n \n \twork_tree = get_git_work_tree();\n \tgit_dir = get_git_dir();\n \tif (!is_absolute_path(git_dir))\n \t\tgit_dir = real_path(get_git_dir());\n \tif (!work_tree || chdir(work_tree))\n-\t\tdie(\"This operation must be run in a work tree\");\n+\t\tdie(_(\"this operation must be run in a work tree\"));\n \n \t/*\n \t * Make sure subsequent git processes find correct worktree\n@@ -525,17 +525,17 @@ void read_gitfile_error_die(int error_code, const char *path, const char *dir)\n \t\t/* non-fatal; follow return path */\n \t\tbreak;\n \tcase READ_GITFILE_ERR_OPEN_FAILED:\n-\t\tdie_errno(\"Error opening '%s'\", path);\n+\t\tdie_errno(_(\"error opening '%s'\"), path);\n \tcase READ_GITFILE_ERR_TOO_LARGE:\n-\t\tdie(\"Too large to be a .git file: '%s'\", path);\n+\t\tdie(_(\"too large to be a .git file: '%s'\"), path);\n \tcase READ_GITFILE_ERR_READ_FAILED:\n-\t\tdie(\"Error reading %s\", path);\n+\t\tdie(_(\"error reading %s\"), path);\n \tcase READ_GITFILE_ERR_INVALID_FORMAT:\n-\t\tdie(\"Invalid gitfile format: %s\", path);\n+\t\tdie(_(\"invalid gitfile format: %s\"), path);\n \tcase READ_GITFILE_ERR_NO_PATH:\n-\t\tdie(\"No path in gitfile: %s\", path);\n+\t\tdie(_(\"no path in gitfile: %s\"), path);\n \tcase READ_GITFILE_ERR_NOT_A_REPO:\n-\t\tdie(\"Not a git repository: %s\", dir);\n+\t\tdie(_(\"not a git repository: %s\"), dir);\n \tdefault:\n \t\tdie(\"BUG: unknown error code\");\n \t}\n@@ -634,7 +634,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \tint offset;\n \n \tif (PATH_MAX - 40 < strlen(gitdirenv))\n-\t\tdie(\"'$%s' too big\", GIT_DIR_ENVIRONMENT);\n+\t\tdie(_(\"'$%s' too big\"), GIT_DIR_ENVIRONMENT);\n \n \tgitfile = (char*)read_gitfile(gitdirenv);\n \tif (gitfile) {\n@@ -648,7 +648,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \t\t\tfree(gitfile);\n \t\t\treturn NULL;\n \t\t}\n-\t\tdie(\"Not a git repository: '%s'\", gitdirenv);\n+\t\tdie(_(\"not a git repository: '%s'\"), gitdirenv);\n \t}\n \n \tif (check_repository_format_gently(gitdirenv, repo_fmt, nongit_ok)) {\n@@ -677,12 +677,12 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \t\telse {\n \t\t\tchar *core_worktree;\n \t\t\tif (chdir(gitdirenv))\n-\t\t\t\tdie_errno(\"Could not chdir to '%s'\", gitdirenv);\n+\t\t\t\tdie_errno(_(\"cannot chdir to '%s'\"), gitdirenv);\n \t\t\tif (chdir(git_work_tree_cfg))\n-\t\t\t\tdie_errno(\"Could not chdir to '%s'\", git_work_tree_cfg);\n+\t\t\t\tdie_errno(_(\"cannot chdir to '%s'\"), git_work_tree_cfg);\n \t\t\tcore_worktree = xgetcwd();\n \t\t\tif (chdir(cwd->buf))\n-\t\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\t        die_errno(_(\"cannot come back to cwd\"));\n \t\t\tset_git_work_tree(core_worktree);\n \t\t\tfree(core_worktree);\n \t\t}\n@@ -710,7 +710,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \tif (offset >= 0) {\t/* cwd inside worktree? */\n \t\tset_git_dir(real_path(gitdirenv));\n \t\tif (chdir(worktree))\n-\t\t\tdie_errno(\"Could not chdir to '%s'\", worktree);\n+\t\t\tdie_errno(_(\"cannot chdir to '%s'\"), worktree);\n \t\tstrbuf_addch(cwd, '/');\n \t\tfree(gitfile);\n \t\treturn cwd->buf + offset;\n@@ -738,7 +738,7 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n \t\tif (offset != cwd->len && !is_absolute_path(gitdir))\n \t\t\tgitdir = to_free = real_pathdup(gitdir, 1);\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t\tret = setup_explicit_git_dir(gitdir, cwd, repo_fmt, nongit_ok);\n \t\tfree(to_free);\n \t\treturn ret;\n@@ -748,7 +748,7 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n \tif (is_bare_repository_cfg > 0) {\n \t\tset_git_dir(offset == cwd->len ? gitdir : real_path(gitdir));\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t\treturn NULL;\n \t}\n \n@@ -787,7 +787,7 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,\n \n \t\tgitdir = offset == cwd->len ? \".\" : xmemdupz(cwd->buf, offset);\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t\treturn setup_explicit_git_dir(gitdir, cwd, repo_fmt, nongit_ok);\n \t}\n \n@@ -795,7 +795,7 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,\n \tinside_work_tree = 0;\n \tif (offset != cwd->len) {\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Cannot come back to cwd\");\n+\t\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t\troot_len = offset_1st_component(cwd->buf);\n \t\tstrbuf_setlen(cwd, offset > root_len ? offset : root_len);\n \t\tset_git_dir(cwd->buf);\n@@ -808,9 +808,9 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,\n static const char *setup_nongit(const char *cwd, int *nongit_ok)\n {\n \tif (!nongit_ok)\n-\t\tdie(_(\"Not a git repository (or any of the parent directories): %s\"), DEFAULT_GIT_DIR_ENVIRONMENT);\n+\t\tdie(_(\"not a git repository (or any of the parent directories): %s\"), DEFAULT_GIT_DIR_ENVIRONMENT);\n \tif (chdir(cwd))\n-\t\tdie_errno(_(\"Cannot come back to cwd\"));\n+\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t*nongit_ok = 1;\n \treturn NULL;\n }\n@@ -819,7 +819,7 @@ static dev_t get_device_or_die(const char *path, const char *prefix, int prefix_\n {\n \tstruct stat buf;\n \tif (stat(path, &buf)) {\n-\t\tdie_errno(\"failed to stat '%*s%s%s'\",\n+\t\tdie_errno(_(\"failed to stat '%*s%s%s'\"),\n \t\t\t\tprefix_len,\n \t\t\t\tprefix ? prefix : \"\",\n \t\t\t\tprefix ? \"/\" : \"\", path);\n@@ -1061,13 +1061,13 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t\tbreak;\n \tcase GIT_DIR_DISCOVERED:\n \t\tif (dir.len < cwd.len && chdir(dir.buf))\n-\t\t\tdie(_(\"Cannot change to '%s'\"), dir.buf);\n+\t\t\tdie(_(\"cannot change to '%s'\"), dir.buf);\n \t\tprefix = setup_discovered_git_dir(gitdir.buf, &cwd, dir.len,\n \t\t\t\t\t\t  &repo_fmt, nongit_ok);\n \t\tbreak;\n \tcase GIT_DIR_BARE:\n \t\tif (dir.len < cwd.len && chdir(dir.buf))\n-\t\t\tdie(_(\"Cannot change to '%s'\"), dir.buf);\n+\t\t\tdie(_(\"cannot change to '%s'\"), dir.buf);\n \t\tprefix = setup_bare_git_dir(&cwd, dir.len, &repo_fmt, nongit_ok);\n \t\tbreak;\n \tcase GIT_DIR_HIT_CEILING:\n@@ -1080,7 +1080,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t\t\tstrbuf_release(&dir);\n \t\t\treturn NULL;\n \t\t}\n-\t\tdie(_(\"Not a git repository (or any parent up to mount point %s)\\n\"\n+\t\tdie(_(\"not a git repository (or any parent up to mount point %s)\\n\"\n \t\t      \"Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\"),\n \t\t    dir.buf);\n \tdefault:\n@@ -1164,7 +1164,7 @@ int git_config_perm(const char *var, const char *value)\n \t/* A filemode value was given: 0xxx */\n \n \tif ((i & 0600) != 0600)\n-\t\tdie(_(\"Problem with core.sharedRepository filemode value \"\n+\t\tdie(_(\"problem with core.sharedRepository filemode value \"\n \t\t    \"(0%.3o).\\nThe owner of files must always have \"\n \t\t    \"read and write permissions.\"), i);\n \n@@ -1207,7 +1207,7 @@ void sanitize_stdfds(void)\n \twhile (fd != -1 && fd < 2)\n \t\tfd = dup(fd);\n \tif (fd == -1)\n-\t\tdie_errno(\"open /dev/null or dup failed\");\n+\t\tdie_errno(_(\"open /dev/null or dup failed\"));\n \tif (fd > 2)\n \t\tclose(fd);\n }\n@@ -1222,12 +1222,12 @@ int daemonize(void)\n \t\tcase 0:\n \t\t\tbreak;\n \t\tcase -1:\n-\t\t\tdie_errno(\"fork failed\");\n+\t\t\tdie_errno(_(\"fork failed\"));\n \t\tdefault:\n \t\t\texit(0);\n \t}\n \tif (setsid() == -1)\n-\t\tdie_errno(\"setsid failed\");\n+\t\tdie_errno(_(\"setsid failed\"));\n \tclose(0);\n \tclose(1);\n \tclose(2);\ndiff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh\nindex 9670e8cbe..309b466d4 100755\n--- a/t/t0002-gitfile.sh\n+++ b/t/t0002-gitfile.sh\n@@ -31,7 +31,7 @@ test_expect_success 'bad setup: invalid .git file format' '\n \t\techo \"git rev-parse accepted an invalid .git file\"\n \t\tfalse\n \tfi &&\n-\tif ! grep \"Invalid gitfile format\" .err\n+\tif ! grep \"invalid gitfile format\" .err\n \tthen\n \t\techo \"git rev-parse returned wrong error\"\n \t\tfalse\n@@ -45,7 +45,7 @@ test_expect_success 'bad setup: invalid .git file path' '\n \t\techo \"git rev-parse accepted an invalid .git file path\"\n \t\tfalse\n \tfi &&\n-\tif ! grep \"Not a git repository\" .err\n+\tif ! grep \"not a git repository\" .err\n \tthen\n \t\techo \"git rev-parse returned wrong error\"\n \t\tfalse\ndiff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh\nindex d27f438bf..5743b482f 100755\n--- a/t/t0008-ignores.sh\n+++ b/t/t0008-ignores.sh\n@@ -307,7 +307,7 @@ test_expect_success_multi 'needs work tree' '' '\n \t\tcd .git &&\n \t\ttest_check_ignore \"foo\" 128\n \t) &&\n-\tstderr_contains \"fatal: This operation must be run in a work tree\"\n+\tstderr_contains \"fatal: this operation must be run in a work tree\"\n '\n \n ############################################################################\n-- \n2.16.1\n\n"},{"id":"338484","messageId":"CAPig+cSOgNfz+cYdcvsbbaf74RB0QNnmqLs9Ld9xdmarMaqzEQ@mail.gmail.com","threadId":"47611","inReplyTo":"20180206061537.2573-2-ash@kambanaria.org","subject":"Re: [PATCH 1/1] Mark messages for translations","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-02-06T07:32:42Z","receivedAt":"2018-02-06T07:32:49Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Feb 6, 2018 at 1:15 AM, Alexander Shopov <ash@kambanaria.org> wrote:\n> Small changes in messages to fit the style and typography of rest\n> Reuse already translated messages if possible\n> Do not translate messages aimed at developers of git\n> Fix unit tests depending on the original string\n>\n> Signed-off-by: Alexander Shopov <ash@kambanaria.org>\n> ---\n> diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh\n> @@ -31,7 +31,7 @@ test_expect_success 'bad setup: invalid .git file format' '\n>                 echo \"git rev-parse accepted an invalid .git file\"\n>                 false\n>         fi &&\n> -       if ! grep \"Invalid gitfile format\" .err\n> +       if ! grep \"invalid gitfile format\" .err\n\nSince these strings can now be translated, you'll probably need to use\n'test_i18ngrep' rather than 'grep'. (See test_i18ngrep in\nt/test-lib.sh.)\n\n>         then\n>                 echo \"git rev-parse returned wrong error\"\n>                 false\n> @@ -45,7 +45,7 @@ test_expect_success 'bad setup: invalid .git file path' '\n>                 echo \"git rev-parse accepted an invalid .git file path\"\n>                 false\n>         fi &&\n> -       if ! grep \"Not a git repository\" .err\n> +       if ! grep \"not a git repository\" .err\n>         then\n>                 echo \"git rev-parse returned wrong error\"\n>                 false\n> diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh\n> index d27f438bf..5743b482f 100755\n> --- a/t/t0008-ignores.sh\n> +++ b/t/t0008-ignores.sh\n> @@ -307,7 +307,7 @@ test_expect_success_multi 'needs work tree' '' '\n>                 cd .git &&\n>                 test_check_ignore \"foo\" 128\n>         ) &&\n> -       stderr_contains \"fatal: This operation must be run in a work tree\"\n> +       stderr_contains \"fatal: this operation must be run in a work tree\"\n>  '\n"},{"id":"338485","messageId":"20180206073812.GA14133@sigill.intra.peff.net","threadId":"47611","inReplyTo":"CAPig+cSOgNfz+cYdcvsbbaf74RB0QNnmqLs9Ld9xdmarMaqzEQ@mail.gmail.com","subject":"Re: [PATCH 1/1] Mark messages for translations","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-02-06T07:38:12Z","receivedAt":"2018-02-06T07:38:18Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Feb 06, 2018 at 02:32:42AM -0500, Eric Sunshine wrote:\n\n> > diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh\n> > @@ -31,7 +31,7 @@ test_expect_success 'bad setup: invalid .git file format' '\n> >                 echo \"git rev-parse accepted an invalid .git file\"\n> >                 false\n> >         fi &&\n> > -       if ! grep \"Invalid gitfile format\" .err\n> > +       if ! grep \"invalid gitfile format\" .err\n> \n> Since these strings can now be translated, you'll probably need to use\n> 'test_i18ngrep' rather than 'grep'. (See test_i18ngrep in\n> t/test-lib.sh.)\n\nGood catch. Looks like there's another in t1506, which you can see with\n\"make GETTEXT_POISON=1 test\".\n\n-Peff\n"},{"id":"338815","messageId":"20180209074404.2902-1-ash@kambanaria.org","threadId":"47611","inReplyTo":"20180206073812.GA14133@sigill.intra.peff.net","subject":"[PATCH 0/1] Mark messages for translations","fromName":"Alexander Shopov","fromEmail":"ash@kambanaria.org","sentAt":"2018-02-09T07:44:03Z","receivedAt":"2018-02-09T07:44:28Z","isPatch":true,"sender":{"key":"ash@kambanaria.org","avatar":"https://avatars.githubusercontent.com/u/449359?v=4"},"body":"\nHi all,\n\nContinuing with ths suggestions for improvements.\n\nRacap since last time:\n\nEric Sunshine:\n  1. Use 'test_i18ngrep' rather than 'grep'\nJeff King:\n  2. Fix t1506\n  \nPrevious changes:\n\nJohannes Sixt:\n  1. Lower-case letters at the beginning of error messages\n  2. Past tense to present tense in some cases\nEric Sunshine:\n  3. Fix `-cname=value` to say `-c <name>=<value>`\n  4. Do not translate \"BUG message\"\nDuy Nguyen:\n  5. Fix parentheses on `_` macro\n\nKind regards:\nal_shopov\n\n\nAlexander Shopov (1):\n  Mark messages for translations\n\n git.c                          | 38 +++++++++++++-------------\n setup.c                        | 62 +++++++++++++++++++++---------------------\n t/t0002-gitfile.sh             |  4 +--\n t/t0008-ignores.sh             |  2 +-\n t/t1506-rev-parse-diagnosis.sh |  2 +-\n 5 files changed, 54 insertions(+), 54 deletions(-)\n\n-- \n2.16.1\n\n"},{"id":"338816","messageId":"20180209074404.2902-2-ash@kambanaria.org","threadId":"47611","inReplyTo":"20180209074404.2902-1-ash@kambanaria.org","subject":"[PATCH 1/1] Mark messages for translations","fromName":"Alexander Shopov","fromEmail":"ash@kambanaria.org","sentAt":"2018-02-09T07:44:04Z","receivedAt":"2018-02-09T07:44:30Z","isPatch":true,"sender":{"key":"ash@kambanaria.org","avatar":"https://avatars.githubusercontent.com/u/449359?v=4"},"body":"Small changes in messages to fit the style and typography of rest\nReuse already translated messages if possible\nDo not translate messages aimed at developers of git\nFix unit tests depending on the original string\nUse `test_i18ngrep` for tests with translatable strings\nChange and verifyrest of tests via `make GETTEXT_POISON=1 test`\n\nSigned-off-by: Alexander Shopov <ash@kambanaria.org>\n---\n git.c                          | 38 +++++++++++++-------------\n setup.c                        | 62 +++++++++++++++++++++---------------------\n t/t0002-gitfile.sh             |  4 +--\n t/t0008-ignores.sh             |  2 +-\n t/t1506-rev-parse-diagnosis.sh |  2 +-\n 5 files changed, 54 insertions(+), 54 deletions(-)\n\ndiff --git a/git.c b/git.c\nindex c870b9719..5ddcb75d4 100644\n--- a/git.c\n+++ b/git.c\n@@ -5,11 +5,11 @@\n #include \"run-command.h\"\n \n const char git_usage_string[] =\n-\t\"git [--version] [--help] [-C <path>] [-c name=value]\\n\"\n-\t\"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\\n\"\n-\t\"           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\\n\"\n-\t\"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\\n\"\n-\t\"           <command> [<args>]\";\n+\tN_(\"git [--version] [--help] [-C <path>] [-c <name>=<value>]\\n\"\n+\t   \"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\\n\"\n+\t   \"           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\\n\"\n+\t   \"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\\n\"\n+\t   \"           <command> [<args>]\");\n \n const char git_more_info_string[] =\n \tN_(\"'git help -a' and 'git help -g' list available subcommands and some\\n\"\n@@ -92,7 +92,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--git-dir\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No directory given for --git-dir.\\n\" );\n+  \t\t\t\tfprintf(stderr, _(\"no directory given for --git-dir\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_DIR_ENVIRONMENT, (*argv)[1], 1);\n@@ -106,7 +106,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--namespace\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No namespace given for --namespace.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"no namespace given for --namespace\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_NAMESPACE_ENVIRONMENT, (*argv)[1], 1);\n@@ -120,7 +120,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--work-tree\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No directory given for --work-tree.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"no directory given for --work-tree\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_WORK_TREE_ENVIRONMENT, (*argv)[1], 1);\n@@ -134,7 +134,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--super-prefix\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No prefix given for --super-prefix.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"no prefix given for --super-prefix\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_SUPER_PREFIX_ENVIRONMENT, (*argv)[1], 1);\n@@ -156,7 +156,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"-c\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"-c expects a configuration string\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"-c expects a configuration string\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tgit_config_push_parameter((*argv)[1]);\n@@ -194,12 +194,12 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"-C\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No directory given for -C.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"no directory given for -C\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tif ((*argv)[1][0]) {\n \t\t\t\tif (chdir((*argv)[1]))\n-\t\t\t\t\tdie_errno(\"Cannot change to '%s'\", (*argv)[1]);\n+\t\t\t\t\tdie_errno(\"cannot change to '%s'\", (*argv)[1]);\n \t\t\t\tif (envchanged)\n \t\t\t\t\t*envchanged = 1;\n \t\t\t}\n@@ -209,7 +209,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\tlist_builtins();\n \t\t\texit(0);\n \t\t} else {\n-\t\t\tfprintf(stderr, \"Unknown option: %s\\n\", cmd);\n+\t\t\tfprintf(stderr, _(\"unknown option: %s\\n\"), cmd);\n \t\t\tusage(git_usage_string);\n \t\t}\n \n@@ -247,7 +247,7 @@ static int handle_alias(int *argcp, const char ***argv)\n \t\t\tif (ret >= 0)   /* normal exit */\n \t\t\t\texit(ret);\n \n-\t\t\tdie_errno(\"While expanding alias '%s': '%s'\",\n+\t\t\tdie_errno(\"while expanding alias '%s': '%s'\",\n \t\t\t    alias_command, alias_string + 1);\n \t\t}\n \t\tcount = split_cmdline(alias_string, &new_argv);\n@@ -256,8 +256,8 @@ static int handle_alias(int *argcp, const char ***argv)\n \t\t\t    split_cmdline_strerror(count));\n \t\toption_count = handle_options(&new_argv, &count, &envchanged);\n \t\tif (envchanged)\n-\t\t\tdie(\"alias '%s' changes environment variables\\n\"\n-\t\t\t\t \"You can use '!git' in the alias to do this.\",\n+\t\t\tdie(\"alias '%s' changes environment variables.\\n\"\n+\t\t\t\t \"You can use '!git' in the alias to do this\",\n \t\t\t\t alias_command);\n \t\tmemmove(new_argv - option_count, new_argv,\n \t\t\t\tcount * sizeof(char *));\n@@ -684,8 +684,8 @@ int cmd_main(int argc, const char **argv)\n \t\tif (errno != ENOENT)\n \t\t\tbreak;\n \t\tif (was_alias) {\n-\t\t\tfprintf(stderr, \"Expansion of alias '%s' failed; \"\n-\t\t\t\t\"'%s' is not a git command\\n\",\n+\t\t\tfprintf(stderr, _(\"expansion of alias '%s' failed; \"\n+\t\t\t\t\t  \"'%s' is not a git command\\n\"),\n \t\t\t\tcmd, argv[0]);\n \t\t\texit(1);\n \t\t}\n@@ -696,7 +696,7 @@ int cmd_main(int argc, const char **argv)\n \t\t\tbreak;\n \t}\n \n-\tfprintf(stderr, \"Failed to run command '%s': %s\\n\",\n+\tfprintf(stderr, _(\"failed to run command '%s': %s\\n\"),\n \t\tcmd, strerror(errno));\n \n \treturn 1;\ndiff --git a/setup.c b/setup.c\nindex 8cc34186c..30894cec9 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -119,7 +119,7 @@ char *prefix_path(const char *prefix, int len, const char *path)\n {\n \tchar *r = prefix_path_gently(prefix, len, NULL, path);\n \tif (!r)\n-\t\tdie(\"'%s' is outside repository\", path);\n+\t\tdie(_(\"'%s' is outside repository\"), path);\n \treturn r;\n }\n \n@@ -160,7 +160,7 @@ int check_filename(const char *prefix, const char *arg)\n \t\tfree(to_free);\n \t\treturn 0; /* file does not exist */\n \t}\n-\tdie_errno(\"failed to stat '%s'\", arg);\n+\tdie_errno(_(\"failed to stat '%s'\"), arg);\n }\n \n static void NORETURN die_verify_filename(const char *prefix,\n@@ -230,7 +230,7 @@ void verify_filename(const char *prefix,\n \t\t     int diagnose_misspelt_rev)\n {\n \tif (*arg == '-')\n-\t\tdie(\"option '%s' must come before non-option arguments\", arg);\n+\t\tdie(_(\"option '%s' must come before non-option arguments\"), arg);\n \tif (looks_like_pathspec(arg) || check_filename(prefix, arg))\n \t\treturn;\n \tdie_verify_filename(prefix, arg, diagnose_misspelt_rev);\n@@ -385,14 +385,14 @@ void setup_work_tree(void)\n \t\treturn;\n \n \tif (work_tree_config_is_bogus)\n-\t\tdie(\"unable to set up work tree using invalid config\");\n+\t\tdie(_(\"unable to set up work tree using invalid config\"));\n \n \twork_tree = get_git_work_tree();\n \tgit_dir = get_git_dir();\n \tif (!is_absolute_path(git_dir))\n \t\tgit_dir = real_path(get_git_dir());\n \tif (!work_tree || chdir(work_tree))\n-\t\tdie(\"This operation must be run in a work tree\");\n+\t\tdie(_(\"this operation must be run in a work tree\"));\n \n \t/*\n \t * Make sure subsequent git processes find correct worktree\n@@ -525,17 +525,17 @@ void read_gitfile_error_die(int error_code, const char *path, const char *dir)\n \t\t/* non-fatal; follow return path */\n \t\tbreak;\n \tcase READ_GITFILE_ERR_OPEN_FAILED:\n-\t\tdie_errno(\"Error opening '%s'\", path);\n+\t\tdie_errno(_(\"error opening '%s'\"), path);\n \tcase READ_GITFILE_ERR_TOO_LARGE:\n-\t\tdie(\"Too large to be a .git file: '%s'\", path);\n+\t\tdie(_(\"too large to be a .git file: '%s'\"), path);\n \tcase READ_GITFILE_ERR_READ_FAILED:\n-\t\tdie(\"Error reading %s\", path);\n+\t\tdie(_(\"error reading %s\"), path);\n \tcase READ_GITFILE_ERR_INVALID_FORMAT:\n-\t\tdie(\"Invalid gitfile format: %s\", path);\n+\t\tdie(_(\"invalid gitfile format: %s\"), path);\n \tcase READ_GITFILE_ERR_NO_PATH:\n-\t\tdie(\"No path in gitfile: %s\", path);\n+\t\tdie(_(\"no path in gitfile: %s\"), path);\n \tcase READ_GITFILE_ERR_NOT_A_REPO:\n-\t\tdie(\"Not a git repository: %s\", dir);\n+\t\tdie(_(\"not a git repository: %s\"), dir);\n \tdefault:\n \t\tdie(\"BUG: unknown error code\");\n \t}\n@@ -634,7 +634,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \tint offset;\n \n \tif (PATH_MAX - 40 < strlen(gitdirenv))\n-\t\tdie(\"'$%s' too big\", GIT_DIR_ENVIRONMENT);\n+\t\tdie(_(\"'$%s' too big\"), GIT_DIR_ENVIRONMENT);\n \n \tgitfile = (char*)read_gitfile(gitdirenv);\n \tif (gitfile) {\n@@ -648,7 +648,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \t\t\tfree(gitfile);\n \t\t\treturn NULL;\n \t\t}\n-\t\tdie(\"Not a git repository: '%s'\", gitdirenv);\n+\t\tdie(_(\"not a git repository: '%s'\"), gitdirenv);\n \t}\n \n \tif (check_repository_format_gently(gitdirenv, repo_fmt, nongit_ok)) {\n@@ -677,12 +677,12 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \t\telse {\n \t\t\tchar *core_worktree;\n \t\t\tif (chdir(gitdirenv))\n-\t\t\t\tdie_errno(\"Could not chdir to '%s'\", gitdirenv);\n+\t\t\t\tdie_errno(_(\"cannot chdir to '%s'\"), gitdirenv);\n \t\t\tif (chdir(git_work_tree_cfg))\n-\t\t\t\tdie_errno(\"Could not chdir to '%s'\", git_work_tree_cfg);\n+\t\t\t\tdie_errno(_(\"cannot chdir to '%s'\"), git_work_tree_cfg);\n \t\t\tcore_worktree = xgetcwd();\n \t\t\tif (chdir(cwd->buf))\n-\t\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\t        die_errno(_(\"cannot come back to cwd\"));\n \t\t\tset_git_work_tree(core_worktree);\n \t\t\tfree(core_worktree);\n \t\t}\n@@ -710,7 +710,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \tif (offset >= 0) {\t/* cwd inside worktree? */\n \t\tset_git_dir(real_path(gitdirenv));\n \t\tif (chdir(worktree))\n-\t\t\tdie_errno(\"Could not chdir to '%s'\", worktree);\n+\t\t\tdie_errno(_(\"cannot chdir to '%s'\"), worktree);\n \t\tstrbuf_addch(cwd, '/');\n \t\tfree(gitfile);\n \t\treturn cwd->buf + offset;\n@@ -738,7 +738,7 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n \t\tif (offset != cwd->len && !is_absolute_path(gitdir))\n \t\t\tgitdir = to_free = real_pathdup(gitdir, 1);\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t\tret = setup_explicit_git_dir(gitdir, cwd, repo_fmt, nongit_ok);\n \t\tfree(to_free);\n \t\treturn ret;\n@@ -748,7 +748,7 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n \tif (is_bare_repository_cfg > 0) {\n \t\tset_git_dir(offset == cwd->len ? gitdir : real_path(gitdir));\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t\treturn NULL;\n \t}\n \n@@ -787,7 +787,7 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,\n \n \t\tgitdir = offset == cwd->len ? \".\" : xmemdupz(cwd->buf, offset);\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t\treturn setup_explicit_git_dir(gitdir, cwd, repo_fmt, nongit_ok);\n \t}\n \n@@ -795,7 +795,7 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,\n \tinside_work_tree = 0;\n \tif (offset != cwd->len) {\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Cannot come back to cwd\");\n+\t\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t\troot_len = offset_1st_component(cwd->buf);\n \t\tstrbuf_setlen(cwd, offset > root_len ? offset : root_len);\n \t\tset_git_dir(cwd->buf);\n@@ -808,9 +808,9 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,\n static const char *setup_nongit(const char *cwd, int *nongit_ok)\n {\n \tif (!nongit_ok)\n-\t\tdie(_(\"Not a git repository (or any of the parent directories): %s\"), DEFAULT_GIT_DIR_ENVIRONMENT);\n+\t\tdie(_(\"not a git repository (or any of the parent directories): %s\"), DEFAULT_GIT_DIR_ENVIRONMENT);\n \tif (chdir(cwd))\n-\t\tdie_errno(_(\"Cannot come back to cwd\"));\n+\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t*nongit_ok = 1;\n \treturn NULL;\n }\n@@ -819,7 +819,7 @@ static dev_t get_device_or_die(const char *path, const char *prefix, int prefix_\n {\n \tstruct stat buf;\n \tif (stat(path, &buf)) {\n-\t\tdie_errno(\"failed to stat '%*s%s%s'\",\n+\t\tdie_errno(_(\"failed to stat '%*s%s%s'\"),\n \t\t\t\tprefix_len,\n \t\t\t\tprefix ? prefix : \"\",\n \t\t\t\tprefix ? \"/\" : \"\", path);\n@@ -1061,13 +1061,13 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t\tbreak;\n \tcase GIT_DIR_DISCOVERED:\n \t\tif (dir.len < cwd.len && chdir(dir.buf))\n-\t\t\tdie(_(\"Cannot change to '%s'\"), dir.buf);\n+\t\t\tdie(_(\"cannot change to '%s'\"), dir.buf);\n \t\tprefix = setup_discovered_git_dir(gitdir.buf, &cwd, dir.len,\n \t\t\t\t\t\t  &repo_fmt, nongit_ok);\n \t\tbreak;\n \tcase GIT_DIR_BARE:\n \t\tif (dir.len < cwd.len && chdir(dir.buf))\n-\t\t\tdie(_(\"Cannot change to '%s'\"), dir.buf);\n+\t\t\tdie(_(\"cannot change to '%s'\"), dir.buf);\n \t\tprefix = setup_bare_git_dir(&cwd, dir.len, &repo_fmt, nongit_ok);\n \t\tbreak;\n \tcase GIT_DIR_HIT_CEILING:\n@@ -1080,7 +1080,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t\t\tstrbuf_release(&dir);\n \t\t\treturn NULL;\n \t\t}\n-\t\tdie(_(\"Not a git repository (or any parent up to mount point %s)\\n\"\n+\t\tdie(_(\"not a git repository (or any parent up to mount point %s)\\n\"\n \t\t      \"Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\"),\n \t\t    dir.buf);\n \tdefault:\n@@ -1164,7 +1164,7 @@ int git_config_perm(const char *var, const char *value)\n \t/* A filemode value was given: 0xxx */\n \n \tif ((i & 0600) != 0600)\n-\t\tdie(_(\"Problem with core.sharedRepository filemode value \"\n+\t\tdie(_(\"problem with core.sharedRepository filemode value \"\n \t\t    \"(0%.3o).\\nThe owner of files must always have \"\n \t\t    \"read and write permissions.\"), i);\n \n@@ -1207,7 +1207,7 @@ void sanitize_stdfds(void)\n \twhile (fd != -1 && fd < 2)\n \t\tfd = dup(fd);\n \tif (fd == -1)\n-\t\tdie_errno(\"open /dev/null or dup failed\");\n+\t\tdie_errno(_(\"open /dev/null or dup failed\"));\n \tif (fd > 2)\n \t\tclose(fd);\n }\n@@ -1222,12 +1222,12 @@ int daemonize(void)\n \t\tcase 0:\n \t\t\tbreak;\n \t\tcase -1:\n-\t\t\tdie_errno(\"fork failed\");\n+\t\t\tdie_errno(_(\"fork failed\"));\n \t\tdefault:\n \t\t\texit(0);\n \t}\n \tif (setsid() == -1)\n-\t\tdie_errno(\"setsid failed\");\n+\t\tdie_errno(_(\"setsid failed\"));\n \tclose(0);\n \tclose(1);\n \tclose(2);\ndiff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh\nindex 9670e8cbe..797dcf95b 100755\n--- a/t/t0002-gitfile.sh\n+++ b/t/t0002-gitfile.sh\n@@ -31,7 +31,7 @@ test_expect_success 'bad setup: invalid .git file format' '\n \t\techo \"git rev-parse accepted an invalid .git file\"\n \t\tfalse\n \tfi &&\n-\tif ! grep \"Invalid gitfile format\" .err\n+\tif ! test_i18ngrep \"invalid gitfile format\" .err\n \tthen\n \t\techo \"git rev-parse returned wrong error\"\n \t\tfalse\n@@ -45,7 +45,7 @@ test_expect_success 'bad setup: invalid .git file path' '\n \t\techo \"git rev-parse accepted an invalid .git file path\"\n \t\tfalse\n \tfi &&\n-\tif ! grep \"Not a git repository\" .err\n+\tif ! test_i18ngrep \"not a git repository\" .err\n \tthen\n \t\techo \"git rev-parse returned wrong error\"\n \t\tfalse\ndiff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh\nindex d27f438bf..5743b482f 100755\n--- a/t/t0008-ignores.sh\n+++ b/t/t0008-ignores.sh\n@@ -307,7 +307,7 @@ test_expect_success_multi 'needs work tree' '' '\n \t\tcd .git &&\n \t\ttest_check_ignore \"foo\" 128\n \t) &&\n-\tstderr_contains \"fatal: This operation must be run in a work tree\"\n+\tstderr_contains \"fatal: this operation must be run in a work tree\"\n '\n \n ############################################################################\ndiff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh\nindex 79a0251ef..4ee009da6 100755\n--- a/t/t1506-rev-parse-diagnosis.sh\n+++ b/t/t1506-rev-parse-diagnosis.sh\n@@ -157,7 +157,7 @@ test_expect_success 'relative path not found' '\n test_expect_success 'relative path outside worktree' '\n \ttest_must_fail git rev-parse HEAD:../file.txt >output 2>error &&\n \ttest -z \"$(cat output)\" &&\n-\tgrep \"outside repository\" error\n+\ttest_i18ngrep \"outside repository\" error\n '\n \n test_expect_success 'relative path when cwd is outside worktree' '\n-- \n2.16.1\n\n"},{"id":"338886","messageId":"xmqqlgg2xbx0.fsf@gitster-ct.c.googlers.com","threadId":"47611","inReplyTo":"20180209074404.2902-2-ash@kambanaria.org","subject":"Re: [PATCH 1/1] Mark messages for translations","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-02-09T18:20:27Z","receivedAt":"2018-02-09T18:20:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexander Shopov <ash@kambanaria.org> writes:\n\n> Small changes in messages to fit the style and typography of rest\n> Reuse already translated messages if possible\n> Do not translate messages aimed at developers of git\n> Fix unit tests depending on the original string\n> Use `test_i18ngrep` for tests with translatable strings\n> Change and verifyrest of tests via `make GETTEXT_POISON=1 test`\n\nPerhaps end each sentence with a full-stop?\n\n> diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh\n> index 9670e8cbe..797dcf95b 100755\n> --- a/t/t0002-gitfile.sh\n> +++ b/t/t0002-gitfile.sh\n> @@ -31,7 +31,7 @@ test_expect_success 'bad setup: invalid .git file format' '\n>  \t\techo \"git rev-parse accepted an invalid .git file\"\n>  \t\tfalse\n>  \tfi &&\n> -\tif ! grep \"Invalid gitfile format\" .err\n> +\tif ! test_i18ngrep \"invalid gitfile format\" .err\n\nShouldn't this rather be like so instead?\n\n\tif test_i18ngrep ! \"invalid gitfile format\" .err\n\nDitto for the other negated use of test_i18ngrep we see in the same\nfile in this patch.\n"},{"id":"338898","messageId":"xmqqwozmvuth.fsf@gitster-ct.c.googlers.com","threadId":"47611","inReplyTo":"xmqqlgg2xbx0.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 1/1] Mark messages for translations","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-02-09T19:15:06Z","receivedAt":"2018-02-09T19:15:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>> -\tif ! grep \"Invalid gitfile format\" .err\n>> +\tif ! test_i18ngrep \"invalid gitfile format\" .err\n>\n> Shouldn't this rather be like so instead?\n>\n> \tif test_i18ngrep ! \"invalid gitfile format\" .err\n>\n> Ditto for the other negated use of test_i18ngrep we see in the same\n> file in this patch.\n\nSorry, my thinko.  These two ones want to be written in the patch\nas-is.\n\n"},{"id":"338900","messageId":"20180209193039.GA15554@sigill.intra.peff.net","threadId":"47611","inReplyTo":"xmqqwozmvuth.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 1/1] Mark messages for translations","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-02-09T19:30:39Z","receivedAt":"2018-02-09T19:30:46Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Feb 09, 2018 at 11:15:06AM -0800, Junio C Hamano wrote:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> >> -\tif ! grep \"Invalid gitfile format\" .err\n> >> +\tif ! test_i18ngrep \"invalid gitfile format\" .err\n> >\n> > Shouldn't this rather be like so instead?\n> >\n> > \tif test_i18ngrep ! \"invalid gitfile format\" .err\n> >\n> > Ditto for the other negated use of test_i18ngrep we see in the same\n> > file in this patch.\n> \n> Sorry, my thinko.  These two ones want to be written in the patch\n> as-is.\n\nYes, I think so, but we may want to avoid this anti-pattern (since\nusually \"! test_i18ngrep\" is a sign of something wrong. It seems like\nthese tests are doing more manual reporting work than is necessary, and\ncould just be relying on helpers to report errors.\n\nSomething like the patch below, though I'm not sure if we'd want to\nleave it as \"grep\" (if applying on master), or have \"test_i18ngrep\" in\nthe preimage (if basing on top of Alexander's patch).\n\n-Peff\n\n---\n t/t0002-gitfile.sh | 54 +++++++----------------------------\n 1 file changed, 11 insertions(+), 43 deletions(-)\n\ndiff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh\nindex 9670e8cbe6..74b7307997 100755\n--- a/t/t0002-gitfile.sh\n+++ b/t/t0002-gitfile.sh\n@@ -10,15 +10,6 @@ objpath() {\n \techo \"$1\" | sed -e 's|\\(..\\)|\\1/|'\n }\n \n-objck() {\n-\tp=$(objpath \"$1\")\n-\tif test ! -f \"$REAL/objects/$p\"\n-\tthen\n-\t\techo \"Object not found: $REAL/objects/$p\"\n-\t\tfalse\n-\tfi\n-}\n-\n test_expect_success 'initial setup' '\n \tREAL=\"$(pwd)/.real\" &&\n \tmv .git \"$REAL\"\n@@ -26,30 +17,14 @@ test_expect_success 'initial setup' '\n \n test_expect_success 'bad setup: invalid .git file format' '\n \techo \"gitdir $REAL\" >.git &&\n-\tif git rev-parse 2>.err\n-\tthen\n-\t\techo \"git rev-parse accepted an invalid .git file\"\n-\t\tfalse\n-\tfi &&\n-\tif ! grep \"Invalid gitfile format\" .err\n-\tthen\n-\t\techo \"git rev-parse returned wrong error\"\n-\t\tfalse\n-\tfi\n+\ttest_must_fail git rev-parse 2>.err &&\n+\ttest_i18ngrep \"Invalid gitfile format\" .err\n '\n \n test_expect_success 'bad setup: invalid .git file path' '\n \techo \"gitdir: $REAL.not\" >.git &&\n-\tif git rev-parse 2>.err\n-\tthen\n-\t\techo \"git rev-parse accepted an invalid .git file path\"\n-\t\tfalse\n-\tfi &&\n-\tif ! grep \"Not a git repository\" .err\n-\tthen\n-\t\techo \"git rev-parse returned wrong error\"\n-\t\tfalse\n-\tfi\n+\ttest_must_fail git rev-parse 2>.err &&\n+\ttest_i18ngrep \"Not a git repository\" .err\n '\n \n test_expect_success 'final setup + check rev-parse --git-dir' '\n@@ -60,7 +35,7 @@ test_expect_success 'final setup + check rev-parse --git-dir' '\n test_expect_success 'check hash-object' '\n \techo \"foo\" >bar &&\n \tSHA=$(cat bar | git hash-object -w --stdin) &&\n-\tobjck $SHA\n+\ttest_path_is_file \"$REAL/objects/$(objpath $SHA)\"\n '\n \n test_expect_success 'check cat-file' '\n@@ -69,29 +44,22 @@ test_expect_success 'check cat-file' '\n '\n \n test_expect_success 'check update-index' '\n-\tif test -f \"$REAL/index\"\n-\tthen\n-\t\techo \"Hmm, $REAL/index exists?\"\n-\t\tfalse\n-\tfi &&\n+\ttest_path_is_missing \"$REAL/index\" &&\n \trm -f \"$REAL/objects/$(objpath $SHA)\" &&\n \tgit update-index --add bar &&\n-\tif ! test -f \"$REAL/index\"\n-\tthen\n-\t\techo \"$REAL/index not found\"\n-\t\tfalse\n-\tfi &&\n-\tobjck $SHA\n+\ttest_path_is_file \"$REAL/index\" &&\n+\ttest_path_is_file \"$REAL/objects/$(objpath $SHA)\" &&\n+\tfalse\n '\n \n test_expect_success 'check write-tree' '\n \tSHA=$(git write-tree) &&\n-\tobjck $SHA\n+\ttest_path_is_file \"$REAL/objects/$(objpath $SHA)\"\n '\n \n test_expect_success 'check commit-tree' '\n \tSHA=$(echo \"commit bar\" | git commit-tree $SHA) &&\n-\tobjck $SHA\n+\ttest_path_is_file \"$REAL/objects/$(objpath $SHA)\"\n '\n \n test_expect_success 'check rev-list' '\n"},{"id":"338983","messageId":"20180210113128.GA11191@sigill.intra.peff.net","threadId":"47611","inReplyTo":"20180209193039.GA15554@sigill.intra.peff.net","subject":"[PATCH] t0002: simplify error checking","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-02-10T11:31:29Z","receivedAt":"2018-02-10T11:31:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Feb 09, 2018 at 02:30:39PM -0500, Jeff King wrote:\n\n> Yes, I think so, but we may want to avoid this anti-pattern (since\n> usually \"! test_i18ngrep\" is a sign of something wrong. It seems like\n> these tests are doing more manual reporting work than is necessary, and\n> could just be relying on helpers to report errors.\n> \n> Something like the patch below, though I'm not sure if we'd want to\n> leave it as \"grep\" (if applying on master), or have \"test_i18ngrep\" in\n> the preimage (if basing on top of Alexander's patch).\n\nHere's a version suitable for applying to master as an independent\ncleanup. It will conflict with Alexander's patch, but the resolution is\npretty easy (take my side, but s/grep/test_i18ngrep/). I'm happy to do\nit on top of his if that's easier.\n\n-- >8 --\nSubject: [PATCH] t0002: simplify error checking\n\nThis ancient test script does a lot of manual checking of\ntest conditions with \"if\" blocks. We can simplify this\nby relying on helpers like test_must_fail.\n\nNote that a failing \"grep\" call here won't produce any\nverbose output, but that's OK. These days we rely on \"-x\" to\ntell us about such commands. And in addition, these greps\nare soon to be converted to test_i18ngrep (which is itself\nsoon learning to be more verbose).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n t/t0002-gitfile.sh | 53 +++++++++-------------------------------------\n 1 file changed, 10 insertions(+), 43 deletions(-)\n\ndiff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh\nindex 9670e8cbe6..fb8d094117 100755\n--- a/t/t0002-gitfile.sh\n+++ b/t/t0002-gitfile.sh\n@@ -10,15 +10,6 @@ objpath() {\n \techo \"$1\" | sed -e 's|\\(..\\)|\\1/|'\n }\n \n-objck() {\n-\tp=$(objpath \"$1\")\n-\tif test ! -f \"$REAL/objects/$p\"\n-\tthen\n-\t\techo \"Object not found: $REAL/objects/$p\"\n-\t\tfalse\n-\tfi\n-}\n-\n test_expect_success 'initial setup' '\n \tREAL=\"$(pwd)/.real\" &&\n \tmv .git \"$REAL\"\n@@ -26,30 +17,14 @@ test_expect_success 'initial setup' '\n \n test_expect_success 'bad setup: invalid .git file format' '\n \techo \"gitdir $REAL\" >.git &&\n-\tif git rev-parse 2>.err\n-\tthen\n-\t\techo \"git rev-parse accepted an invalid .git file\"\n-\t\tfalse\n-\tfi &&\n-\tif ! grep \"Invalid gitfile format\" .err\n-\tthen\n-\t\techo \"git rev-parse returned wrong error\"\n-\t\tfalse\n-\tfi\n+\ttest_must_fail git rev-parse 2>.err &&\n+\tgrep \"Invalid gitfile format\" .err\n '\n \n test_expect_success 'bad setup: invalid .git file path' '\n \techo \"gitdir: $REAL.not\" >.git &&\n-\tif git rev-parse 2>.err\n-\tthen\n-\t\techo \"git rev-parse accepted an invalid .git file path\"\n-\t\tfalse\n-\tfi &&\n-\tif ! grep \"Not a git repository\" .err\n-\tthen\n-\t\techo \"git rev-parse returned wrong error\"\n-\t\tfalse\n-\tfi\n+\ttest_must_fail git rev-parse 2>.err &&\n+\tgrep \"Not a git repository\" .err\n '\n \n test_expect_success 'final setup + check rev-parse --git-dir' '\n@@ -60,7 +35,7 @@ test_expect_success 'final setup + check rev-parse --git-dir' '\n test_expect_success 'check hash-object' '\n \techo \"foo\" >bar &&\n \tSHA=$(cat bar | git hash-object -w --stdin) &&\n-\tobjck $SHA\n+\ttest_path_is_file \"$REAL/objects/$(objpath $SHA)\"\n '\n \n test_expect_success 'check cat-file' '\n@@ -69,29 +44,21 @@ test_expect_success 'check cat-file' '\n '\n \n test_expect_success 'check update-index' '\n-\tif test -f \"$REAL/index\"\n-\tthen\n-\t\techo \"Hmm, $REAL/index exists?\"\n-\t\tfalse\n-\tfi &&\n+\ttest_path_is_missing \"$REAL/index\" &&\n \trm -f \"$REAL/objects/$(objpath $SHA)\" &&\n \tgit update-index --add bar &&\n-\tif ! test -f \"$REAL/index\"\n-\tthen\n-\t\techo \"$REAL/index not found\"\n-\t\tfalse\n-\tfi &&\n-\tobjck $SHA\n+\ttest_path_is_file \"$REAL/index\" &&\n+\ttest_path_is_file \"$REAL/objects/$(objpath $SHA)\"\n '\n \n test_expect_success 'check write-tree' '\n \tSHA=$(git write-tree) &&\n-\tobjck $SHA\n+\ttest_path_is_file \"$REAL/objects/$(objpath $SHA)\"\n '\n \n test_expect_success 'check commit-tree' '\n \tSHA=$(echo \"commit bar\" | git commit-tree $SHA) &&\n-\tobjck $SHA\n+\ttest_path_is_file \"$REAL/objects/$(objpath $SHA)\"\n '\n \n test_expect_success 'check rev-list' '\n-- \n2.16.1.464.gc4bae515b7\n\n"},{"id":"339079","messageId":"CAP6f5MnjhyP+Ty4zqS3sP2mgYfK3RiKm3=YpFE3LABxx7nUBkw@mail.gmail.com","threadId":"47611","inReplyTo":"20180209193039.GA15554@sigill.intra.peff.net","subject":"Re: [PATCH 1/1] Mark messages for translations","fromName":"Alexander Shopov","fromEmail":"ash@kambanaria.org","sentAt":"2018-02-12T15:03:49Z","receivedAt":"2018-02-12T15:03:56Z","isPatch":true,"sender":{"key":"ash@kambanaria.org","avatar":"https://avatars.githubusercontent.com/u/449359?v=4"},"body":"Let me repeat what you said so I know how to improve the patch:\n@Junio:\n> Perhaps end each sentence with a full-stop?\nI should end each sentence in the *log* message with \".\" (rather than\nthe translatable strings in the patch)\n\n> Shouldn't this rather be like so instead?\n> if test_i18ngrep ! \"invalid gitfile format\" .err\n...\n> These two ones want to be written\nThe standard negation form is:\n   test_i18ngrep !\nbut I should leave the `!` in front of `test_i18ngrep` in this particular case\n\n@Jeff:\n> we may want to avoid this anti-pattern\nCurrent state of these tests is wrong and I should rework them.\n\nHere is what I intend to do:\n1. Fix the commit message\n2. Check whether I can get the tests in t0002-gitfile.sh to the\nstandard `test_i18ngrep !` negative (i.e. without using `if`)\n3. Post and ask for feedback again\n\nKind regards:\nal_shopov\n"},{"id":"339081","messageId":"20180212151500.GA21208@sigill.intra.peff.net","threadId":"47611","inReplyTo":"CAP6f5MnjhyP+Ty4zqS3sP2mgYfK3RiKm3=YpFE3LABxx7nUBkw@mail.gmail.com","subject":"Re: [PATCH 1/1] Mark messages for translations","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-02-12T15:15:00Z","receivedAt":"2018-02-12T15:15:07Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Feb 12, 2018 at 04:03:49PM +0100, Alexander Shopov wrote:\n\n> @Jeff:\n> > we may want to avoid this anti-pattern\n> Current state of these tests is wrong and I should rework them.\n> \n> Here is what I intend to do:\n> 1. Fix the commit message\n> 2. Check whether I can get the tests in t0002-gitfile.sh to the\n> standard `test_i18ngrep !` negative (i.e. without using `if`)\n> 3. Post and ask for feedback again\n\nSee the patch I posted earlier. For (2), \"test_i18ngrep !\" would be the\nwrong thing. I think you should either:\n\n  - keep your patch as-is, and let Junio resolve the conflict when the\n    two are merged\n\n  - rebase your patch on top of mine. That's slightly less work for\n    Junio, but it means that your topic cannot graduate until mine does\n    (though hopefully mine is pretty non-controversial).\n\nI'd probably just do the first in your place, since the conflict is easy\nto resolve.\n\n-Peff\n"},{"id":"339196","messageId":"20180213131915.5707-1-ash@kambanaria.org","threadId":"47611","inReplyTo":"20180212151500.GA21208@sigill.intra.peff.net","subject":"[PATCH 0/1] Mark messages for translation","fromName":"Alexander Shopov","fromEmail":"ash@kambanaria.org","sentAt":"2018-02-13T13:19:14Z","receivedAt":"2018-02-13T13:19:28Z","isPatch":true,"sender":{"key":"ash@kambanaria.org","avatar":"https://avatars.githubusercontent.com/u/449359?v=4"},"body":"Following suggestions on last email exchange:\n\nJunio C Hamano\n  1. End sentences in long log message with '.'\n  2. Leave final merge fixes to him based on suggestion from Jeff King  \n\nPrevious changes:\n\nEric Sunshine:\n  1. Use 'test_i18ngrep' rather than 'grep'\nJeff King:\n  2. Fix t1506\nJohannes Sixt:\n  3. Lower-case letters at the beginning of error messages\n  4. Past tense to present tense in some cases\nEric Sunshine:\n  5. Fix `-cname=value` to say `-c <name>=<value>`\n  6. Do not translate \"BUG message\"\nDuy Nguyen:\n  7. Fix parentheses on `_` macro\n\nKind regards:\nal_shopov\n\n\n\nAlexander Shopov (1):\n  Mark messages for translations\n\n git.c                          | 38 +++++++++++++-------------\n setup.c                        | 62 +++++++++++++++++++++---------------------\n t/t0002-gitfile.sh             |  4 +--\n t/t0008-ignores.sh             |  2 +-\n t/t1506-rev-parse-diagnosis.sh |  2 +-\n 5 files changed, 54 insertions(+), 54 deletions(-)\n\n-- \n2.16.1\n\n"},{"id":"339197","messageId":"20180213131915.5707-2-ash@kambanaria.org","threadId":"47611","inReplyTo":"20180213131915.5707-1-ash@kambanaria.org","subject":"[PATCH 1/1] Mark messages for translations","fromName":"Alexander Shopov","fromEmail":"ash@kambanaria.org","sentAt":"2018-02-13T13:19:15Z","receivedAt":"2018-02-13T13:19:33Z","isPatch":true,"sender":{"key":"ash@kambanaria.org","avatar":"https://avatars.githubusercontent.com/u/449359?v=4"},"body":"Small changes in messages to fit the style and typography of rest.\nReuse already translated messages if possible.\nDo not translate messages aimed at developers of git.\nFix unit tests depending on the original string.\nUse `test_i18ngrep` for tests with translatable strings.\nChange and verify rest of tests via `make GETTEXT_POISON=1 test`.\n\nSigned-off-by: Alexander Shopov <ash@kambanaria.org>\n---\n git.c                          | 38 +++++++++++++-------------\n setup.c                        | 62 +++++++++++++++++++++---------------------\n t/t0002-gitfile.sh             |  4 +--\n t/t0008-ignores.sh             |  2 +-\n t/t1506-rev-parse-diagnosis.sh |  2 +-\n 5 files changed, 54 insertions(+), 54 deletions(-)\n\ndiff --git a/git.c b/git.c\nindex c870b9719..5ddcb75d4 100644\n--- a/git.c\n+++ b/git.c\n@@ -5,11 +5,11 @@\n #include \"run-command.h\"\n \n const char git_usage_string[] =\n-\t\"git [--version] [--help] [-C <path>] [-c name=value]\\n\"\n-\t\"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\\n\"\n-\t\"           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\\n\"\n-\t\"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\\n\"\n-\t\"           <command> [<args>]\";\n+\tN_(\"git [--version] [--help] [-C <path>] [-c <name>=<value>]\\n\"\n+\t   \"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\\n\"\n+\t   \"           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\\n\"\n+\t   \"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\\n\"\n+\t   \"           <command> [<args>]\");\n \n const char git_more_info_string[] =\n \tN_(\"'git help -a' and 'git help -g' list available subcommands and some\\n\"\n@@ -92,7 +92,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--git-dir\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No directory given for --git-dir.\\n\" );\n+  \t\t\t\tfprintf(stderr, _(\"no directory given for --git-dir\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_DIR_ENVIRONMENT, (*argv)[1], 1);\n@@ -106,7 +106,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--namespace\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No namespace given for --namespace.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"no namespace given for --namespace\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_NAMESPACE_ENVIRONMENT, (*argv)[1], 1);\n@@ -120,7 +120,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--work-tree\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No directory given for --work-tree.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"no directory given for --work-tree\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_WORK_TREE_ENVIRONMENT, (*argv)[1], 1);\n@@ -134,7 +134,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--super-prefix\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No prefix given for --super-prefix.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"no prefix given for --super-prefix\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tsetenv(GIT_SUPER_PREFIX_ENVIRONMENT, (*argv)[1], 1);\n@@ -156,7 +156,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"-c\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"-c expects a configuration string\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"-c expects a configuration string\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tgit_config_push_parameter((*argv)[1]);\n@@ -194,12 +194,12 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"-C\")) {\n \t\t\tif (*argc < 2) {\n-\t\t\t\tfprintf(stderr, \"No directory given for -C.\\n\" );\n+\t\t\t\tfprintf(stderr, _(\"no directory given for -C\\n\" ));\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n \t\t\tif ((*argv)[1][0]) {\n \t\t\t\tif (chdir((*argv)[1]))\n-\t\t\t\t\tdie_errno(\"Cannot change to '%s'\", (*argv)[1]);\n+\t\t\t\t\tdie_errno(\"cannot change to '%s'\", (*argv)[1]);\n \t\t\t\tif (envchanged)\n \t\t\t\t\t*envchanged = 1;\n \t\t\t}\n@@ -209,7 +209,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\tlist_builtins();\n \t\t\texit(0);\n \t\t} else {\n-\t\t\tfprintf(stderr, \"Unknown option: %s\\n\", cmd);\n+\t\t\tfprintf(stderr, _(\"unknown option: %s\\n\"), cmd);\n \t\t\tusage(git_usage_string);\n \t\t}\n \n@@ -247,7 +247,7 @@ static int handle_alias(int *argcp, const char ***argv)\n \t\t\tif (ret >= 0)   /* normal exit */\n \t\t\t\texit(ret);\n \n-\t\t\tdie_errno(\"While expanding alias '%s': '%s'\",\n+\t\t\tdie_errno(\"while expanding alias '%s': '%s'\",\n \t\t\t    alias_command, alias_string + 1);\n \t\t}\n \t\tcount = split_cmdline(alias_string, &new_argv);\n@@ -256,8 +256,8 @@ static int handle_alias(int *argcp, const char ***argv)\n \t\t\t    split_cmdline_strerror(count));\n \t\toption_count = handle_options(&new_argv, &count, &envchanged);\n \t\tif (envchanged)\n-\t\t\tdie(\"alias '%s' changes environment variables\\n\"\n-\t\t\t\t \"You can use '!git' in the alias to do this.\",\n+\t\t\tdie(\"alias '%s' changes environment variables.\\n\"\n+\t\t\t\t \"You can use '!git' in the alias to do this\",\n \t\t\t\t alias_command);\n \t\tmemmove(new_argv - option_count, new_argv,\n \t\t\t\tcount * sizeof(char *));\n@@ -684,8 +684,8 @@ int cmd_main(int argc, const char **argv)\n \t\tif (errno != ENOENT)\n \t\t\tbreak;\n \t\tif (was_alias) {\n-\t\t\tfprintf(stderr, \"Expansion of alias '%s' failed; \"\n-\t\t\t\t\"'%s' is not a git command\\n\",\n+\t\t\tfprintf(stderr, _(\"expansion of alias '%s' failed; \"\n+\t\t\t\t\t  \"'%s' is not a git command\\n\"),\n \t\t\t\tcmd, argv[0]);\n \t\t\texit(1);\n \t\t}\n@@ -696,7 +696,7 @@ int cmd_main(int argc, const char **argv)\n \t\t\tbreak;\n \t}\n \n-\tfprintf(stderr, \"Failed to run command '%s': %s\\n\",\n+\tfprintf(stderr, _(\"failed to run command '%s': %s\\n\"),\n \t\tcmd, strerror(errno));\n \n \treturn 1;\ndiff --git a/setup.c b/setup.c\nindex 8cc34186c..30894cec9 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -119,7 +119,7 @@ char *prefix_path(const char *prefix, int len, const char *path)\n {\n \tchar *r = prefix_path_gently(prefix, len, NULL, path);\n \tif (!r)\n-\t\tdie(\"'%s' is outside repository\", path);\n+\t\tdie(_(\"'%s' is outside repository\"), path);\n \treturn r;\n }\n \n@@ -160,7 +160,7 @@ int check_filename(const char *prefix, const char *arg)\n \t\tfree(to_free);\n \t\treturn 0; /* file does not exist */\n \t}\n-\tdie_errno(\"failed to stat '%s'\", arg);\n+\tdie_errno(_(\"failed to stat '%s'\"), arg);\n }\n \n static void NORETURN die_verify_filename(const char *prefix,\n@@ -230,7 +230,7 @@ void verify_filename(const char *prefix,\n \t\t     int diagnose_misspelt_rev)\n {\n \tif (*arg == '-')\n-\t\tdie(\"option '%s' must come before non-option arguments\", arg);\n+\t\tdie(_(\"option '%s' must come before non-option arguments\"), arg);\n \tif (looks_like_pathspec(arg) || check_filename(prefix, arg))\n \t\treturn;\n \tdie_verify_filename(prefix, arg, diagnose_misspelt_rev);\n@@ -385,14 +385,14 @@ void setup_work_tree(void)\n \t\treturn;\n \n \tif (work_tree_config_is_bogus)\n-\t\tdie(\"unable to set up work tree using invalid config\");\n+\t\tdie(_(\"unable to set up work tree using invalid config\"));\n \n \twork_tree = get_git_work_tree();\n \tgit_dir = get_git_dir();\n \tif (!is_absolute_path(git_dir))\n \t\tgit_dir = real_path(get_git_dir());\n \tif (!work_tree || chdir(work_tree))\n-\t\tdie(\"This operation must be run in a work tree\");\n+\t\tdie(_(\"this operation must be run in a work tree\"));\n \n \t/*\n \t * Make sure subsequent git processes find correct worktree\n@@ -525,17 +525,17 @@ void read_gitfile_error_die(int error_code, const char *path, const char *dir)\n \t\t/* non-fatal; follow return path */\n \t\tbreak;\n \tcase READ_GITFILE_ERR_OPEN_FAILED:\n-\t\tdie_errno(\"Error opening '%s'\", path);\n+\t\tdie_errno(_(\"error opening '%s'\"), path);\n \tcase READ_GITFILE_ERR_TOO_LARGE:\n-\t\tdie(\"Too large to be a .git file: '%s'\", path);\n+\t\tdie(_(\"too large to be a .git file: '%s'\"), path);\n \tcase READ_GITFILE_ERR_READ_FAILED:\n-\t\tdie(\"Error reading %s\", path);\n+\t\tdie(_(\"error reading %s\"), path);\n \tcase READ_GITFILE_ERR_INVALID_FORMAT:\n-\t\tdie(\"Invalid gitfile format: %s\", path);\n+\t\tdie(_(\"invalid gitfile format: %s\"), path);\n \tcase READ_GITFILE_ERR_NO_PATH:\n-\t\tdie(\"No path in gitfile: %s\", path);\n+\t\tdie(_(\"no path in gitfile: %s\"), path);\n \tcase READ_GITFILE_ERR_NOT_A_REPO:\n-\t\tdie(\"Not a git repository: %s\", dir);\n+\t\tdie(_(\"not a git repository: %s\"), dir);\n \tdefault:\n \t\tdie(\"BUG: unknown error code\");\n \t}\n@@ -634,7 +634,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \tint offset;\n \n \tif (PATH_MAX - 40 < strlen(gitdirenv))\n-\t\tdie(\"'$%s' too big\", GIT_DIR_ENVIRONMENT);\n+\t\tdie(_(\"'$%s' too big\"), GIT_DIR_ENVIRONMENT);\n \n \tgitfile = (char*)read_gitfile(gitdirenv);\n \tif (gitfile) {\n@@ -648,7 +648,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \t\t\tfree(gitfile);\n \t\t\treturn NULL;\n \t\t}\n-\t\tdie(\"Not a git repository: '%s'\", gitdirenv);\n+\t\tdie(_(\"not a git repository: '%s'\"), gitdirenv);\n \t}\n \n \tif (check_repository_format_gently(gitdirenv, repo_fmt, nongit_ok)) {\n@@ -677,12 +677,12 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \t\telse {\n \t\t\tchar *core_worktree;\n \t\t\tif (chdir(gitdirenv))\n-\t\t\t\tdie_errno(\"Could not chdir to '%s'\", gitdirenv);\n+\t\t\t\tdie_errno(_(\"cannot chdir to '%s'\"), gitdirenv);\n \t\t\tif (chdir(git_work_tree_cfg))\n-\t\t\t\tdie_errno(\"Could not chdir to '%s'\", git_work_tree_cfg);\n+\t\t\t\tdie_errno(_(\"cannot chdir to '%s'\"), git_work_tree_cfg);\n \t\t\tcore_worktree = xgetcwd();\n \t\t\tif (chdir(cwd->buf))\n-\t\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\t        die_errno(_(\"cannot come back to cwd\"));\n \t\t\tset_git_work_tree(core_worktree);\n \t\t\tfree(core_worktree);\n \t\t}\n@@ -710,7 +710,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \tif (offset >= 0) {\t/* cwd inside worktree? */\n \t\tset_git_dir(real_path(gitdirenv));\n \t\tif (chdir(worktree))\n-\t\t\tdie_errno(\"Could not chdir to '%s'\", worktree);\n+\t\t\tdie_errno(_(\"cannot chdir to '%s'\"), worktree);\n \t\tstrbuf_addch(cwd, '/');\n \t\tfree(gitfile);\n \t\treturn cwd->buf + offset;\n@@ -738,7 +738,7 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n \t\tif (offset != cwd->len && !is_absolute_path(gitdir))\n \t\t\tgitdir = to_free = real_pathdup(gitdir, 1);\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t\tret = setup_explicit_git_dir(gitdir, cwd, repo_fmt, nongit_ok);\n \t\tfree(to_free);\n \t\treturn ret;\n@@ -748,7 +748,7 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n \tif (is_bare_repository_cfg > 0) {\n \t\tset_git_dir(offset == cwd->len ? gitdir : real_path(gitdir));\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t\treturn NULL;\n \t}\n \n@@ -787,7 +787,7 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,\n \n \t\tgitdir = offset == cwd->len ? \".\" : xmemdupz(cwd->buf, offset);\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t\treturn setup_explicit_git_dir(gitdir, cwd, repo_fmt, nongit_ok);\n \t}\n \n@@ -795,7 +795,7 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,\n \tinside_work_tree = 0;\n \tif (offset != cwd->len) {\n \t\tif (chdir(cwd->buf))\n-\t\t\tdie_errno(\"Cannot come back to cwd\");\n+\t\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t\troot_len = offset_1st_component(cwd->buf);\n \t\tstrbuf_setlen(cwd, offset > root_len ? offset : root_len);\n \t\tset_git_dir(cwd->buf);\n@@ -808,9 +808,9 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,\n static const char *setup_nongit(const char *cwd, int *nongit_ok)\n {\n \tif (!nongit_ok)\n-\t\tdie(_(\"Not a git repository (or any of the parent directories): %s\"), DEFAULT_GIT_DIR_ENVIRONMENT);\n+\t\tdie(_(\"not a git repository (or any of the parent directories): %s\"), DEFAULT_GIT_DIR_ENVIRONMENT);\n \tif (chdir(cwd))\n-\t\tdie_errno(_(\"Cannot come back to cwd\"));\n+\t\tdie_errno(_(\"cannot come back to cwd\"));\n \t*nongit_ok = 1;\n \treturn NULL;\n }\n@@ -819,7 +819,7 @@ static dev_t get_device_or_die(const char *path, const char *prefix, int prefix_\n {\n \tstruct stat buf;\n \tif (stat(path, &buf)) {\n-\t\tdie_errno(\"failed to stat '%*s%s%s'\",\n+\t\tdie_errno(_(\"failed to stat '%*s%s%s'\"),\n \t\t\t\tprefix_len,\n \t\t\t\tprefix ? prefix : \"\",\n \t\t\t\tprefix ? \"/\" : \"\", path);\n@@ -1061,13 +1061,13 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t\tbreak;\n \tcase GIT_DIR_DISCOVERED:\n \t\tif (dir.len < cwd.len && chdir(dir.buf))\n-\t\t\tdie(_(\"Cannot change to '%s'\"), dir.buf);\n+\t\t\tdie(_(\"cannot change to '%s'\"), dir.buf);\n \t\tprefix = setup_discovered_git_dir(gitdir.buf, &cwd, dir.len,\n \t\t\t\t\t\t  &repo_fmt, nongit_ok);\n \t\tbreak;\n \tcase GIT_DIR_BARE:\n \t\tif (dir.len < cwd.len && chdir(dir.buf))\n-\t\t\tdie(_(\"Cannot change to '%s'\"), dir.buf);\n+\t\t\tdie(_(\"cannot change to '%s'\"), dir.buf);\n \t\tprefix = setup_bare_git_dir(&cwd, dir.len, &repo_fmt, nongit_ok);\n \t\tbreak;\n \tcase GIT_DIR_HIT_CEILING:\n@@ -1080,7 +1080,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t\t\tstrbuf_release(&dir);\n \t\t\treturn NULL;\n \t\t}\n-\t\tdie(_(\"Not a git repository (or any parent up to mount point %s)\\n\"\n+\t\tdie(_(\"not a git repository (or any parent up to mount point %s)\\n\"\n \t\t      \"Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\"),\n \t\t    dir.buf);\n \tdefault:\n@@ -1164,7 +1164,7 @@ int git_config_perm(const char *var, const char *value)\n \t/* A filemode value was given: 0xxx */\n \n \tif ((i & 0600) != 0600)\n-\t\tdie(_(\"Problem with core.sharedRepository filemode value \"\n+\t\tdie(_(\"problem with core.sharedRepository filemode value \"\n \t\t    \"(0%.3o).\\nThe owner of files must always have \"\n \t\t    \"read and write permissions.\"), i);\n \n@@ -1207,7 +1207,7 @@ void sanitize_stdfds(void)\n \twhile (fd != -1 && fd < 2)\n \t\tfd = dup(fd);\n \tif (fd == -1)\n-\t\tdie_errno(\"open /dev/null or dup failed\");\n+\t\tdie_errno(_(\"open /dev/null or dup failed\"));\n \tif (fd > 2)\n \t\tclose(fd);\n }\n@@ -1222,12 +1222,12 @@ int daemonize(void)\n \t\tcase 0:\n \t\t\tbreak;\n \t\tcase -1:\n-\t\t\tdie_errno(\"fork failed\");\n+\t\t\tdie_errno(_(\"fork failed\"));\n \t\tdefault:\n \t\t\texit(0);\n \t}\n \tif (setsid() == -1)\n-\t\tdie_errno(\"setsid failed\");\n+\t\tdie_errno(_(\"setsid failed\"));\n \tclose(0);\n \tclose(1);\n \tclose(2);\ndiff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh\nindex 9670e8cbe..797dcf95b 100755\n--- a/t/t0002-gitfile.sh\n+++ b/t/t0002-gitfile.sh\n@@ -31,7 +31,7 @@ test_expect_success 'bad setup: invalid .git file format' '\n \t\techo \"git rev-parse accepted an invalid .git file\"\n \t\tfalse\n \tfi &&\n-\tif ! grep \"Invalid gitfile format\" .err\n+\tif ! test_i18ngrep \"invalid gitfile format\" .err\n \tthen\n \t\techo \"git rev-parse returned wrong error\"\n \t\tfalse\n@@ -45,7 +45,7 @@ test_expect_success 'bad setup: invalid .git file path' '\n \t\techo \"git rev-parse accepted an invalid .git file path\"\n \t\tfalse\n \tfi &&\n-\tif ! grep \"Not a git repository\" .err\n+\tif ! test_i18ngrep \"not a git repository\" .err\n \tthen\n \t\techo \"git rev-parse returned wrong error\"\n \t\tfalse\ndiff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh\nindex d27f438bf..5743b482f 100755\n--- a/t/t0008-ignores.sh\n+++ b/t/t0008-ignores.sh\n@@ -307,7 +307,7 @@ test_expect_success_multi 'needs work tree' '' '\n \t\tcd .git &&\n \t\ttest_check_ignore \"foo\" 128\n \t) &&\n-\tstderr_contains \"fatal: This operation must be run in a work tree\"\n+\tstderr_contains \"fatal: this operation must be run in a work tree\"\n '\n \n ############################################################################\ndiff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh\nindex 79a0251ef..4ee009da6 100755\n--- a/t/t1506-rev-parse-diagnosis.sh\n+++ b/t/t1506-rev-parse-diagnosis.sh\n@@ -157,7 +157,7 @@ test_expect_success 'relative path not found' '\n test_expect_success 'relative path outside worktree' '\n \ttest_must_fail git rev-parse HEAD:../file.txt >output 2>error &&\n \ttest -z \"$(cat output)\" &&\n-\tgrep \"outside repository\" error\n+\ttest_i18ngrep \"outside repository\" error\n '\n \n test_expect_success 'relative path when cwd is outside worktree' '\n-- \n2.16.1\n\n"}]}