Marked end user messages for translation
cover Marked end user messages for translation
I have marked several messages for translations in git.c and setup.c They pop from time to time on normal usage of git.
The messages are aimed at end users and may help them solve issues. I have tried to keep the C formatting conventions in the two files. I have also reused messages which provides uniformity of the used verb tense and will ease the work of translators.
Alexander Shopov (1):
Mark messages for translations
git.c | 30 +++++++++++++++--------------- setup.c | 52 ++++++++++++++++++++++++++-------------------------- 2 files changed, 41 insertions(+), 41 deletions(-)
Signature · 1 line
2.15.1
PATCH 1/1 Mark messages for translations
Reuse already translated messages if possible Do not translate messages aimed at developers of git
--- git.c | 30 +++++++++++++++--------------- setup.c | 52 ++++++++++++++++++++++++++-------------------------- 2 files changed, 41 insertions(+), 41 deletions(-)
git.c +15 -15
@@ -5,11 +5,11 @@#include "run-command.h" const char git_usage_string[] = -"git [--version] [--help] [-C <path>] [-c name=value]\n" -" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" -" [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n" -" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" -" <command> [<args>]" ; +N_ ("git [--version] [--help] [-C <path>] [-c name=value]\n" +" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" +" [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n" +" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" +" <command> [<args>]" );const char git_more_info_string[] = N_("'git help -a' and 'git help -g' list available subcommands and some\n"
@@ -92,7 +92,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--git-dir" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for --git-dir.\n" ); +fprintf (stderr,_ ("No directory given for --git-dir.\n" ));usage (git_usage_string); }setenv (GIT_DIR_ENVIRONMENT , (*argv)[1 ],1 );
@@ -106,7 +106,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--namespace" )) {if (*argc <2 ) { -fprintf (stderr,"No namespace given for --namespace.\n" ); +fprintf (stderr,_ ("No namespace given for --namespace.\n" ));usage (git_usage_string); }setenv (GIT_NAMESPACE_ENVIRONMENT , (*argv)[1 ],1 );
@@ -120,7 +120,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--work-tree" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for --work-tree.\n" ); +fprintf (stderr,_ ("No directory given for --work-tree.\n" ));usage (git_usage_string); }setenv (GIT_WORK_TREE_ENVIRONMENT , (*argv)[1 ],1 );
@@ -134,7 +134,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--super-prefix" )) {if (*argc <2 ) { -fprintf (stderr,"No prefix given for --super-prefix.\n" ); +fprintf (stderr,_ ("No prefix given for --super-prefix.\n" ));usage (git_usage_string); }setenv (GIT_SUPER_PREFIX_ENVIRONMENT , (*argv)[1 ],1 );
@@ -156,7 +156,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"-c" )) {if (*argc <2 ) { -fprintf (stderr,"-c expects a configuration string\n" ); +fprintf (stderr,_ ("-c expects a configuration string\n" ));usage (git_usage_string); }git_config_push_parameter ((*argv)[1 ]);
@@ -194,7 +194,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"-C" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for -C.\n" ); +fprintf (stderr,_ ("No directory given for -C.\n" ));usage (git_usage_string); }if ((*argv)[1 ][0 ]) {
@@ -209,7 +209,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)list_builtins ();exit (0 ); }else { -fprintf (stderr,"Unknown option: %s\n" , cmd); +fprintf (stderr,_ ("Unknown option: %s\n" ), cmd);usage (git_usage_string); }
@@ -684,8 +684,8 @@ int cmd_main(int argc, const char **argv)if (errno !=ENOENT )break ;if (was_alias) { -fprintf (stderr,"Expansion of alias '%s' failed; " -"'%s' is not a git command\n" , +fprintf (stderr,_ ("Expansion of alias '%s' failed; " +"'%s' is not a git command\n" ), cmd, argv[0 ]);exit (1 ); }
@@ -696,7 +696,7 @@ int cmd_main(int argc, const char **argv)break ; } -fprintf (stderr,"Failed to run command '%s': %s\n" , +fprintf (stderr,_ ("Failed to run command '%s': %s\n" ), cmd,strerror (errno));return 1 ;
setup.c +26 -26
167 lines not on this page · raw message
Signature · 1 line
2.15.1
Re: [PATCH 1/1] Mark messages for translations
Am 15.01.2018 um 06:44 schrieb Alexander Shopov:
Quoted 18 lines
git.c +5
-5@@ -5,11 +5,11 @@#include "run-command.h" const char git_usage_string[] = -"git [--version] [--help] [-C <path>] [-c name=value]\n" -" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" -" [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n" -" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" -" <command> [<args>]" ; +N_ ("git [--version] [--help] [-C <path>] [-c name=value]\n" +" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" +" [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n" +" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" +" <command> [<args>]" );const char git_more_info_string[] = N_("'git help -a' and 'git help -g' list available subcommands and some\n"
git.c static int handle_options(const char ***argv, int *argc, int *envchanged) · line 96
Quoted 6 lines
git.c +1
-1@@ -92,7 +92,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--git-dir" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for --git-dir.\n" ); +fprintf (stderr,_ ("No directory given for --git-dir.\n" ));usage (git_usage_string);
It is not obvious to me where git_usage_string is looked up in the message catalog. Should this not be
usage(_(git_usage_string));
(here and in later instances)? It is used that way in builtin/help.c, for example.
Quoted 4 lines
setup.c +0
-0@@ -385,14 +385,14 @@ void setup_work_tree(void)return ;if (work_tree_config_is_bogus)
setup.c void setup_work_tree(void) · line 395
Quoted 10 lines
setup.c +2
-2-die ("unable to set up work tree using invalid config" ); +die (_ ("unable to set up work tree using invalid config" )); work_tree =get_git_work_tree (); git_dir =get_git_dir ();if (!is_absolute_path (git_dir)) git_dir =real_path (get_git_dir ());if (!work_tree ||chdir (work_tree)) -die ("This operation must be run in a work tree" ); +die (_ ("This operation must be run in a work tree" ));
We have settled with lower-case letters at the beginning of error messages. (See Documentation/CodingGuidelines, "Error Messages".) You could fix that while you are touching die, die_errno, etc, messages.
setup.c static const char *setup_explicit_git_dir(const char *gitdirenv, · line 680
Quoted 6 lines
setup.c +1
-1@@ -677,12 +677,12 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,else {char *core_worktree;if (chdir (gitdirenv)) -die_errno ("Could not chdir to '%s'" , gitdirenv); +die_errno (_ ("Cannot chdir to '%s'" ), gitdirenv);
I notice you change past tense to present tense in some cases. IMO, this makes the messages more consistent. Good.
I'm not a friend of geeky abbreviations like "chdir" or "cwd" in user-visible messages, and I would have taken the opportunity to change the messages accordingly. This is really only my personal taste, though, and it's possible that I'm alone in this camp.
Quoted 7 lines
setup.c +2
-2if (chdir (git_work_tree_cfg)) -die_errno ("Could not chdir to '%s'" , git_work_tree_cfg); +die_errno (_ ("Cannot chdir to '%s'" ), git_work_tree_cfg); core_worktree =xgetcwd ();if (chdir (cwd->buf)) -die_errno ("Could not come back to cwd" ); + die_errno(_("Cannot come back to cwd");
...
Quoted 11 lines
setup.c +1
-1@@ -1207,7 +1207,7 @@ void sanitize_stdfds(void)while (fd !=-1 && fd <2 ) fd =dup (fd);if (fd ==-1 ) -die_errno ("open /dev/null or dup failed" ); +die_errno (_ ("open /dev/null or dup failed" ));if (fd >2 )close (fd); }@@ -1222,12 +1222,12 @@ int daemonize(void)case 0 :
setup.c int daemonize(void) · line 1230
Quoted 10 lines
setup.c +2
-2break ;case -1 : -die_errno ("fork failed" ); +die_errno (_ ("fork failed" ));default :exit (0 ); }if (setsid () ==-1 ) -die_errno ("setsid failed" ); +die_errno (_ ("setsid failed" ));
Here is a certain class of errors: They should occur only rarely (actually, is that true?) Then it is useful to have the function name in the message. Which rises the question: why translate them at all? It's possible that translators turn the message into unusable gibberish just to please their language. All of this is only IMHO; I don't use translated Git.
-- Hannes
A message that is not in the archive (sent off-list or not yet received): CAP6f5Mnn+pRdL6ihgwcqsTwyGy+EQfBbgPxkFmGLcWL-hJx-8g@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): CAP6f5MnaMiqEMbGW_xj6X495jF=txpzeq+DEHOkz7VCg2D6D9w@mail.gmail.com
Re: [PATCH 1/1] Mark messages for translations
And again, sigh:
Quoted 1 line
Quoted 1 line
const char git_usage_string[] =
....
Quoted 3 lines
Quoted 1 line
const char git_more_info_string[] =
It is not obvious to me where
git_usage_stringis looked up in the message catalog. It is used that way inbuiltin/help.c..
I wanted to be consistent with the current state of the file. This is the same way const char git_more_info_string[] is defined and initialized. Having it this way saves the lookup on each usage I guess but any performance gains will be negligible. Is there a convention?
Quoted 3 lines
We have settled with lower-case letters at the beginning of error messages. (See
Documentation/CodingGuidelines, "Error Messages".) You could fix that while you are touching die,die_errno, etc, messages.
Great! It will allow for further reduction in repetition of messages.
Quoted 1 line
I notice you change past tense to present tense in some cases.
I am reading this that messages SHOULD be in present tense (unless they MUST be in past tense). This is good. Perhaps I will look at current messages and then fix en masse (if there is sth to fix).
Quoted 2 lines
I'm not a friend of geeky abbreviations like "chdir" or "cwd" in user-visible messages
I agree but I would also keep in mind that using the name of the function may alllow to parametrize the messages like:
Cannot execute "%s" on "%s" - for example. Anyway this is not that important for me. Will wait for other opinions.
Quoted 7 lines
setup.c int daemonize(void) · line 1230
Quoted 4 lines
setup.c +2
-2-die_errno ("fork failed" ); +die_errno (_ ("fork failed" )); -die_errno ("setsid failed" ); +die_errno (_ ("setsid failed" ));it is useful to have the function name in the message. Which rises the question:why translate them at all?
Why not eat the cake while having it - one can pass function name in a
message like: '"%s" failed'
Regards:al_shopov
Re: [PATCH 1/1] Mark messages for translations
In reply to Alexander ShopovQuoted 2 lines · Alexander Shopov
Reuse already translated messages if possible Do not translate messages aimed at developers of git
A couple comments beyond those from Hannes...
git.c line 6
Quoted 6 lines
Signed-off-by Alexander Shopov <[email protected]>---
git.c +1
-0@@ -5,11 +5,11 @@const char git_usage_string[] = + N_("git [--version] [--help] [-C <path>] [-c name=value]\n"
Since you're touching this, perhaps take the opportunity to fix -c name=value to say -c <name>=<value>?
setup.c void read_gitfile_error_die(int error_code, const char *path, const char *dir) · line 528
Quoted 12 lines
git.c +4
-0+" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" +" [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n" +" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" + " <command> [<args>]");setup.c +2
-2@@ -525,19 +525,19 @@ void read_gitfile_error_die(int error_code, const char *path, const char *dir)case READ_GITFILE_ERR_NOT_A_REPO : -die ("Not a git repository: %s" , dir); +die (_ ("Not a git repository: %s" ), dir);default : -die ("BUG: unknown error code" ); +die (_ ("BUG: unknown error code" ));
This last one is aimed at developers (indeed, "BUG" message should never been seen by end-users). I'd leave it untranslated.
Quoted 2 lines
setup.c +0
-0} }
Re: [PATCH 1/1] Mark messages for translations
In reply to Alexander Shopovsetup.c int check_filename(const char *prefix, const char *arg) · line 164
Quoted 7 lines · Alexander Shopov
setup.c +1
-1@@ -160,7 +160,7 @@ int check_filename(const char *prefix, const char *arg)free (to_free);return 0 ;/* file does not exist */ } -die_errno ("failed to stat '%s'" , arg); +die_errno (_ ("failed to stat '%s'" , arg)); }
The new ")" is at a wrong place. It should be %s'"), arg); not %s'", arg));
Signature · 1 line
Duy
cover Mark messages for translations
In reply to Alexander Shopov*** BLURB HERE ***
Hi all,
Again I am marking messages for translations in gui.c and setup.c based on the feedback I got last time. Now I am fixing unit tests as well, hopefully no regressions.
Here is a recap:
Johannes Sixt:
1. Lower-case letters at the beginning of error messages
2. Past tense to present tense in some cases
Eric Sunshine:
3. Fix -cname=value to say -c <name>=<value>
4. Do not translate "BUG message"
Duy Nguyen:
5. Fix parentheses on _ macro
Kind regards:al_shopov
Alexander Shopov (1):
Mark messages for translations
git.c | 38 ++++++++++++++++----------------- setup.c | 62 +++++++++++++++++++++++++++--------------------------- t/t0002-gitfile.sh | 4 ++-- t/t0008-ignores.sh | 2 +- 4 files changed, 53 insertions(+), 53 deletions(-)
Signature · 1 line
2.16.1
PATCH 1/1 Mark messages for translations
Small changes in messages to fit the style and typography of rest Reuse already translated messages if possible
Do not translate messages aimed at developers of git Fix unit tests depending on the original string
--- git.c | 38 ++++++++++++++++----------------- setup.c | 62 +++++++++++++++++++++++++++--------------------------- t/t0002-gitfile.sh | 4 ++-- t/t0008-ignores.sh | 2 +- 4 files changed, 53 insertions(+), 53 deletions(-)
git.c +19 -19
@@ -5,11 +5,11 @@#include "run-command.h" const char git_usage_string[] = -"git [--version] [--help] [-C <path>] [-c name=value]\n" -" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" -" [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n" -" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" -" <command> [<args>]" ; +N_ ("git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" +" [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n" +" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" +" <command> [<args>]" );const char git_more_info_string[] = N_("'git help -a' and 'git help -g' list available subcommands and some\n"
@@ -92,7 +92,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--git-dir" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for --git-dir.\n" ); +fprintf (stderr,_ ("no directory given for --git-dir\n" ));usage (git_usage_string); }setenv (GIT_DIR_ENVIRONMENT , (*argv)[1 ],1 );
@@ -106,7 +106,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--namespace" )) {if (*argc <2 ) { -fprintf (stderr,"No namespace given for --namespace.\n" ); +fprintf (stderr,_ ("no namespace given for --namespace\n" ));usage (git_usage_string); }setenv (GIT_NAMESPACE_ENVIRONMENT , (*argv)[1 ],1 );
@@ -120,7 +120,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--work-tree" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for --work-tree.\n" ); +fprintf (stderr,_ ("no directory given for --work-tree\n" ));usage (git_usage_string); }setenv (GIT_WORK_TREE_ENVIRONMENT , (*argv)[1 ],1 );
@@ -134,7 +134,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--super-prefix" )) {if (*argc <2 ) { -fprintf (stderr,"No prefix given for --super-prefix.\n" ); +fprintf (stderr,_ ("no prefix given for --super-prefix\n" ));usage (git_usage_string); }setenv (GIT_SUPER_PREFIX_ENVIRONMENT , (*argv)[1 ],1 );
@@ -156,7 +156,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"-c" )) {if (*argc <2 ) { -fprintf (stderr,"-c expects a configuration string\n" ); +fprintf (stderr,_ ("-c expects a configuration string\n" ));usage (git_usage_string); }git_config_push_parameter ((*argv)[1 ]);
@@ -194,12 +194,12 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"-C" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for -C.\n" ); +fprintf (stderr,_ ("no directory given for -C\n" ));usage (git_usage_string); }if ((*argv)[1 ][0 ]) {if (chdir ((*argv)[1 ])) -die_errno ("Cannot change to '%s'" , (*argv)[1 ]); +die_errno ("cannot change to '%s'" , (*argv)[1 ]);if (envchanged) *envchanged =1 ; }
@@ -209,7 +209,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)list_builtins ();exit (0 ); }else { -fprintf (stderr,"Unknown option: %s\n" , cmd); +fprintf (stderr,_ ("unknown option: %s\n" ), cmd);usage (git_usage_string); }
@@ -247,7 +247,7 @@ static int handle_alias(int *argcp, const char ***argv)if (ret >=0 )/* normal exit */ exit (ret); -die_errno ("While expanding alias '%s': '%s'" , +die_errno ("while expanding alias '%s': '%s'" , alias_command, alias_string +1 ); } count =split_cmdline (alias_string, &new_argv);
@@ -256,8 +256,8 @@ static int handle_alias(int *argcp, const char ***argv) split_cmdline_strerror(count)); option_count =handle_options (&new_argv, &count, &envchanged);if (envchanged) -die ("alias '%s' changes environment variables\n" -"You can use '!git' in the alias to do this." , +die ("alias '%s' changes environment variables.\n" +"You can use '!git' in the alias to do this" , alias_command);memmove (new_argv - option_count, new_argv, count *sizeof (char *));
@@ -684,8 +684,8 @@ int cmd_main(int argc, const char **argv)if (errno !=ENOENT )break ;if (was_alias) { -fprintf (stderr,"Expansion of alias '%s' failed; " -"'%s' is not a git command\n" , +fprintf (stderr,_ ("expansion of alias '%s' failed; " +"'%s' is not a git command\n" ), cmd, argv[0 ]);exit (1 ); }
@@ -696,7 +696,7 @@ int cmd_main(int argc, const char **argv)break ; } -fprintf (stderr,"Failed to run command '%s': %s\n" , +fprintf (stderr,_ ("failed to run command '%s': %s\n" ), cmd,strerror (errno));return 1 ;
setup.c +31 -31
206 lines not on this page · raw message
t/t0002-gitfile.sh +2 -2
@@ -31,7 +31,7 @@ test_expect_success 'bad setup: invalid .git file format' ' echo "git rev-parse accepted an invalid .git file" false fi && - if ! grep "Invalid gitfile format" .err + if ! grep "invalid gitfile format" .err then echo "git rev-parse returned wrong error" false
@@ -45,7 +45,7 @@ test_expect_success 'bad setup: invalid .git file path' ' echo "git rev-parse accepted an invalid .git file path" false fi && - if ! grep "Not a git repository" .err + if ! grep "not a git repository" .err then echo "git rev-parse returned wrong error" false
t/t0008-ignores.sh +1 -1
@@ -307,7 +307,7 @@ test_expect_success_multi 'needs work tree' '' ' cd .git && test_check_ignore "foo" 128 ) && - stderr_contains "fatal: This operation must be run in a work tree" + stderr_contains "fatal: this operation must be run in a work tree" ' ############################################################################
Signature · 1 line
2.16.1
Re: [PATCH 1/1] Mark messages for translations
Quoted 9 lines · Alexander Shopov
Small changes in messages to fit the style and typography of rest Reuse already translated messages if possible
Do not translate messages aimed at developers of git Fix unit tests depending on the original stringSigned-off-by Alexander Shopov <[email protected]>---
t/t0002-gitfile.sh test_expect_success 'bad setup: invalid .git file format' ' · line 34
Quoted 5 lines
t/t0002-gitfile.sh +1
-1@@ -31,7 +31,7 @@ test_expect_success 'bad setup: invalid .git file format' ' echo "git rev-parse accepted an invalid .git file" false fi && - if ! grep "Invalid gitfile format" .err + if ! grep "invalid gitfile format" .err
Since these strings can now be translated, you'll probably need to use 'test_i18ngrep' rather than 'grep'. (See test_i18ngrep in t/test-lib.sh.)
Quoted 23 lines
t/t0002-gitfile.sh +1
-1then echo "git rev-parse returned wrong error" false@@ -45,7 +45,7 @@ test_expect_success 'bad setup: invalid .git file path' ' echo "git rev-parse accepted an invalid .git file path" false fi && - if ! grep "Not a git repository" .err + if ! grep "not a git repository" .err then echo "git rev-parse returned wrong error" falset/t0008-ignores.sh +1
-1@@ -307,7 +307,7 @@ test_expect_success_multi 'needs work tree' '' ' cd .git && test_check_ignore "foo" 128 ) && - stderr_contains "fatal: This operation must be run in a work tree" + stderr_contains "fatal: this operation must be run in a work tree" '
Re: [PATCH 1/1] Mark messages for translations
Quoted 11 lines · Eric Sunshine
t/t0002-gitfile.sh test_expect_success 'bad setup: invalid .git file format' ' · line 34
Quoted 7 lines
t/t0002-gitfile.sh +1
-1@@ -31,7 +31,7 @@ test_expect_success 'bad setup: invalid .git file format' ' echo "git rev-parse accepted an invalid .git file" false fi && - if ! grep "Invalid gitfile format" .err + if ! grep "invalid gitfile format" .errSince these strings can now be translated, you'll probably need to use '
test_i18ngrep' rather than 'grep'. (Seetest_i18ngrepint/test-lib.sh.)
Good catch. Looks like there's another in t1506, which you can see with "make GETTEXT_POISON=1 test".
-Peff
cover Mark messages for translations
Hi all,
Continuing with ths suggestions for improvements.
Racap since last time:
Eric Sunshine:
1. Use 'test_i18ngrep' rather than 'grep'
Jeff King:
2. Fix t1506
Previous changes:
Johannes Sixt:
1. Lower-case letters at the beginning of error messages
2. Past tense to present tense in some cases
Eric Sunshine:
3. Fix -cname=value to say -c <name>=<value>
4. Do not translate "BUG message"
Duy Nguyen:
5. Fix parentheses on _ macro
Kind regards:al_shopov
Alexander Shopov (1):
Mark messages for translations
git.c | 38 +++++++++++++------------- setup.c | 62 +++++++++++++++++++++--------------------- t/t0002-gitfile.sh | 4 +-- t/t0008-ignores.sh | 2 +- t/t1506-rev-parse-diagnosis.sh | 2 +- 5 files changed, 54 insertions(+), 54 deletions(-)
Signature · 1 line
2.16.1
PATCH 1/1 Mark messages for translations
Small changes in messages to fit the style and typography of rest Reuse already translated messages if possible
Do not translate messages aimed at developers of git Fix unit tests depending on the original string
Use test_i18ngrep for tests with translatable strings Change and verifyrest of tests via make GETTEXT_POISON=1 test
--- git.c | 38 +++++++++++++------------- setup.c | 62 +++++++++++++++++++++--------------------- t/t0002-gitfile.sh | 4 +-- t/t0008-ignores.sh | 2 +- t/t1506-rev-parse-diagnosis.sh | 2 +- 5 files changed, 54 insertions(+), 54 deletions(-)
git.c +19 -19
@@ -5,11 +5,11 @@#include "run-command.h" const char git_usage_string[] = -"git [--version] [--help] [-C <path>] [-c name=value]\n" -" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" -" [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n" -" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" -" <command> [<args>]" ; +N_ ("git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" +" [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n" +" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" +" <command> [<args>]" );const char git_more_info_string[] = N_("'git help -a' and 'git help -g' list available subcommands and some\n"
@@ -92,7 +92,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--git-dir" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for --git-dir.\n" ); +fprintf (stderr,_ ("no directory given for --git-dir\n" ));usage (git_usage_string); }setenv (GIT_DIR_ENVIRONMENT , (*argv)[1 ],1 );
@@ -106,7 +106,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--namespace" )) {if (*argc <2 ) { -fprintf (stderr,"No namespace given for --namespace.\n" ); +fprintf (stderr,_ ("no namespace given for --namespace\n" ));usage (git_usage_string); }setenv (GIT_NAMESPACE_ENVIRONMENT , (*argv)[1 ],1 );
@@ -120,7 +120,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--work-tree" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for --work-tree.\n" ); +fprintf (stderr,_ ("no directory given for --work-tree\n" ));usage (git_usage_string); }setenv (GIT_WORK_TREE_ENVIRONMENT , (*argv)[1 ],1 );
@@ -134,7 +134,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--super-prefix" )) {if (*argc <2 ) { -fprintf (stderr,"No prefix given for --super-prefix.\n" ); +fprintf (stderr,_ ("no prefix given for --super-prefix\n" ));usage (git_usage_string); }setenv (GIT_SUPER_PREFIX_ENVIRONMENT , (*argv)[1 ],1 );
@@ -156,7 +156,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"-c" )) {if (*argc <2 ) { -fprintf (stderr,"-c expects a configuration string\n" ); +fprintf (stderr,_ ("-c expects a configuration string\n" ));usage (git_usage_string); }git_config_push_parameter ((*argv)[1 ]);
@@ -194,12 +194,12 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"-C" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for -C.\n" ); +fprintf (stderr,_ ("no directory given for -C\n" ));usage (git_usage_string); }if ((*argv)[1 ][0 ]) {if (chdir ((*argv)[1 ])) -die_errno ("Cannot change to '%s'" , (*argv)[1 ]); +die_errno ("cannot change to '%s'" , (*argv)[1 ]);if (envchanged) *envchanged =1 ; }
@@ -209,7 +209,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)list_builtins ();exit (0 ); }else { -fprintf (stderr,"Unknown option: %s\n" , cmd); +fprintf (stderr,_ ("unknown option: %s\n" ), cmd);usage (git_usage_string); }
@@ -247,7 +247,7 @@ static int handle_alias(int *argcp, const char ***argv)if (ret >=0 )/* normal exit */ exit (ret); -die_errno ("While expanding alias '%s': '%s'" , +die_errno ("while expanding alias '%s': '%s'" , alias_command, alias_string +1 ); } count =split_cmdline (alias_string, &new_argv);
@@ -256,8 +256,8 @@ static int handle_alias(int *argcp, const char ***argv) split_cmdline_strerror(count)); option_count =handle_options (&new_argv, &count, &envchanged);if (envchanged) -die ("alias '%s' changes environment variables\n" -"You can use '!git' in the alias to do this." , +die ("alias '%s' changes environment variables.\n" +"You can use '!git' in the alias to do this" , alias_command);memmove (new_argv - option_count, new_argv, count *sizeof (char *));
@@ -684,8 +684,8 @@ int cmd_main(int argc, const char **argv)if (errno !=ENOENT )break ;if (was_alias) { -fprintf (stderr,"Expansion of alias '%s' failed; " -"'%s' is not a git command\n" , +fprintf (stderr,_ ("expansion of alias '%s' failed; " +"'%s' is not a git command\n" ), cmd, argv[0 ]);exit (1 ); }
@@ -696,7 +696,7 @@ int cmd_main(int argc, const char **argv)break ; } -fprintf (stderr,"Failed to run command '%s': %s\n" , +fprintf (stderr,_ ("failed to run command '%s': %s\n" ), cmd,strerror (errno));return 1 ;
setup.c +31 -31
206 lines not on this page · raw message
t/t0002-gitfile.sh +2 -2
@@ -31,7 +31,7 @@ test_expect_success 'bad setup: invalid .git file format' ' echo "git rev-parse accepted an invalid .git file" false fi && - if ! grep "Invalid gitfile format" .err + if ! test_i18ngrep "invalid gitfile format" .err then echo "git rev-parse returned wrong error" false
@@ -45,7 +45,7 @@ test_expect_success 'bad setup: invalid .git file path' ' echo "git rev-parse accepted an invalid .git file path" false fi && - if ! grep "Not a git repository" .err + if ! test_i18ngrep "not a git repository" .err then echo "git rev-parse returned wrong error" false
t/t0008-ignores.sh +1 -1
@@ -307,7 +307,7 @@ test_expect_success_multi 'needs work tree' '' ' cd .git && test_check_ignore "foo" 128 ) && - stderr_contains "fatal: This operation must be run in a work tree" + stderr_contains "fatal: this operation must be run in a work tree" ' ############################################################################
t/t1506-rev-parse-diagnosis.sh +1 -1
@@ -157,7 +157,7 @@ test_expect_success 'relative path not found' ' test_expect_success 'relative path outside worktree' ' test_must_fail git rev-parse HEAD:../file.txt >output 2>error && test -z "$(cat output)" && - grep "outside repository" error + test_i18ngrep "outside repository" error ' test_expect_success 'relative path when cwd is outside worktree' '
Signature · 1 line
2.16.1
Re: [PATCH 1/1] Mark messages for translations
Quoted 6 lines · Alexander Shopov
Small changes in messages to fit the style and typography of rest Reuse already translated messages if possible
Do not translate messages aimed at developers of git Fix unit tests depending on the original string
Usetest_i18ngrepfor tests with translatable strings Change and verifyrest of tests viamake GETTEXT_POISON=1 test
Perhaps end each sentence with a full-stop?
t/t0002-gitfile.sh test_expect_success 'bad setup: invalid .git file format' ' · line 34
Quoted 10 lines
t/t0002-gitfile.sh +1
-1@@ -31,7 +31,7 @@ test_expect_success 'bad setup: invalid .git file format' ' echo "git rev-parse accepted an invalid .git file" false fi && - if ! grep "Invalid gitfile format" .err + if ! test_i18ngrep "invalid gitfile format" .err
Shouldn't this rather be like so instead?
if test_i18ngrep ! "invalid gitfile format" .err
Ditto for the other negated use of test_i18ngrep we see in the same file in this patch.
Re: [PATCH 1/1] Mark messages for translations
Quoted 9 lines · Junio C Hamano
t/t0002-gitfile.sh test_expect_success 'bad setup: invalid .git file format' ' · line 34
Quoted 2 lines
t/t0002-gitfile.sh +1
-1- if ! grep "Invalid gitfile format" .err + if ! test_i18ngrep "invalid gitfile format" .errShouldn't this rather be like so instead?
if
test_i18ngrep! "invalid gitfile format" .errDitto for the other negated use of
test_i18ngrepwe see in the same file in this patch.
Sorry, my thinko. These two ones want to be written in the patch as-is.
Re: [PATCH 1/1] Mark messages for translations
Quoted 7 lines · Junio C Hamano
Quoted 5 lines · Junio C Hamano
Review
Quoted 2 lines
(quoted diff) +1
-1- if ! grep "Invalid gitfile format" .err + if ! test_i18ngrep "invalid gitfile format" .errShouldn't this rather be like so instead?
Quoted 7 lines
Quoted 4 lines
if
test_i18ngrep! "invalid gitfile format" .errDitto for the other negated use of
test_i18ngrepwe see in the same file in this patch.Sorry, my thinko. These two ones want to be written in the patch as-is.
Yes, I think so, but we may want to avoid this anti-pattern (since usually "! test_i18ngrep" is a sign of something wrong. It seems like these tests are doing more manual reporting work than is necessary, and could just be relying on helpers to report errors.
Something like the patch below, though I'm not sure if we'd want to leave it as "grep" (if applying on master), or have "test_i18ngrep" in the preimage (if basing on top of Alexander's patch).
-Peff
--- t/t0002-gitfile.sh | 54 +++++++---------------------------- 1 file changed, 11 insertions(+), 43 deletions(-)
t/t0002-gitfile.sh +11 -43
@@ -10,15 +10,6 @@ objpath() { echo "$1" | sed -e 's|\(..\)|\1/|' } -objck() { - p=$(objpath "$1") - if test ! -f "$REAL/objects/$p" - then - echo "Object not found: $REAL/objects/$p" - false - fi -} - test_expect_success 'initial setup' ' REAL="$(pwd)/.real" && mv .git "$REAL"
@@ -26,30 +17,14 @@ test_expect_success 'initial setup' ' test_expect_success 'bad setup: invalid .git file format' ' echo "gitdir $REAL" >.git && - if git rev-parse 2>.err - then - echo "git rev-parse accepted an invalid .git file" - false - fi && - if ! grep "Invalid gitfile format" .err - then - echo "git rev-parse returned wrong error" - false - fi + test_must_fail git rev-parse 2>.err && + test_i18ngrep "Invalid gitfile format" .err ' test_expect_success 'bad setup: invalid .git file path' ' echo "gitdir: $REAL.not" >.git && - if git rev-parse 2>.err - then - echo "git rev-parse accepted an invalid .git file path" - false - fi && - if ! grep "Not a git repository" .err - then - echo "git rev-parse returned wrong error" - false - fi + test_must_fail git rev-parse 2>.err && + test_i18ngrep "Not a git repository" .err ' test_expect_success 'final setup + check rev-parse --git-dir' '
@@ -60,7 +35,7 @@ test_expect_success 'final setup + check rev-parse --git-dir' ' test_expect_success 'check hash-object' ' echo "foo" >bar && SHA=$(cat bar | git hash-object -w --stdin) && - objck $SHA + test_path_is_file "$REAL/objects/$(objpath $SHA)" ' test_expect_success 'check cat-file' '
@@ -69,29 +44,22 @@ test_expect_success 'check cat-file' ' ' test_expect_success 'check update-index' ' - if test -f "$REAL/index" - then - echo "Hmm, $REAL/index exists?" - false - fi && + test_path_is_missing "$REAL/index" && rm -f "$REAL/objects/$(objpath $SHA)" && git update-index --add bar && - if ! test -f "$REAL/index" - then - echo "$REAL/index not found" - false - fi && - objck $SHA + test_path_is_file "$REAL/index" && + test_path_is_file "$REAL/objects/$(objpath $SHA)" && + false ' test_expect_success 'check write-tree' ' SHA=$(git write-tree) && - objck $SHA + test_path_is_file "$REAL/objects/$(objpath $SHA)" ' test_expect_success 'check commit-tree' ' SHA=$(echo "commit bar" | git commit-tree $SHA) && - objck $SHA + test_path_is_file "$REAL/objects/$(objpath $SHA)" ' test_expect_success 'check rev-list' '
PATCH 1/1 t0002: simplify error checking
Quoted 8 lines · Jeff King
Yes, I think so, but we may want to avoid this anti-pattern (since usually "!
test_i18ngrep" is a sign of something wrong. It seems like these tests are doing more manual reporting work than is necessary, and could just be relying on helpers to report errors.Something like the patch below, though I'm not sure if we'd want to leave it as "grep" (if applying on master), or have "
test_i18ngrep" in the preimage (if basing on top of Alexander's patch).
Here's a version suitable for applying to master as an independent cleanup. It will conflict with Alexander's patch, but the resolution is pretty easy (take my side, but s/grep/test_i18ngrep/). I'm happy to do it on top of his if that's easier.
-- >8 --
Subject: [PATCH] t0002: simplify error checking
This ancient test script does a lot of manual checking of test conditions with "if" blocks. We can simplify this by relying on helpers like test_must_fail.
Note that a failing "grep" call here won't produce any verbose output, but that's OK. These days we rely on "-x" to tell us about such commands. And in addition, these greps are soon to be converted to test_i18ngrep (which is itself soon learning to be more verbose).
--- t/t0002-gitfile.sh | 53 +++++++++------------------------------------- 1 file changed, 10 insertions(+), 43 deletions(-)
t/t0002-gitfile.sh +10 -43
@@ -10,15 +10,6 @@ objpath() { echo "$1" | sed -e 's|\(..\)|\1/|' } -objck() { - p=$(objpath "$1") - if test ! -f "$REAL/objects/$p" - then - echo "Object not found: $REAL/objects/$p" - false - fi -} - test_expect_success 'initial setup' ' REAL="$(pwd)/.real" && mv .git "$REAL"
@@ -26,30 +17,14 @@ test_expect_success 'initial setup' ' test_expect_success 'bad setup: invalid .git file format' ' echo "gitdir $REAL" >.git && - if git rev-parse 2>.err - then - echo "git rev-parse accepted an invalid .git file" - false - fi && - if ! grep "Invalid gitfile format" .err - then - echo "git rev-parse returned wrong error" - false - fi + test_must_fail git rev-parse 2>.err && + grep "Invalid gitfile format" .err ' test_expect_success 'bad setup: invalid .git file path' ' echo "gitdir: $REAL.not" >.git && - if git rev-parse 2>.err - then - echo "git rev-parse accepted an invalid .git file path" - false - fi && - if ! grep "Not a git repository" .err - then - echo "git rev-parse returned wrong error" - false - fi + test_must_fail git rev-parse 2>.err && + grep "Not a git repository" .err ' test_expect_success 'final setup + check rev-parse --git-dir' '
@@ -60,7 +35,7 @@ test_expect_success 'final setup + check rev-parse --git-dir' ' test_expect_success 'check hash-object' ' echo "foo" >bar && SHA=$(cat bar | git hash-object -w --stdin) && - objck $SHA + test_path_is_file "$REAL/objects/$(objpath $SHA)" ' test_expect_success 'check cat-file' '
@@ -69,29 +44,21 @@ test_expect_success 'check cat-file' ' ' test_expect_success 'check update-index' ' - if test -f "$REAL/index" - then - echo "Hmm, $REAL/index exists?" - false - fi && + test_path_is_missing "$REAL/index" && rm -f "$REAL/objects/$(objpath $SHA)" && git update-index --add bar && - if ! test -f "$REAL/index" - then - echo "$REAL/index not found" - false - fi && - objck $SHA + test_path_is_file "$REAL/index" && + test_path_is_file "$REAL/objects/$(objpath $SHA)" ' test_expect_success 'check write-tree' ' SHA=$(git write-tree) && - objck $SHA + test_path_is_file "$REAL/objects/$(objpath $SHA)" ' test_expect_success 'check commit-tree' ' SHA=$(echo "commit bar" | git commit-tree $SHA) && - objck $SHA + test_path_is_file "$REAL/objects/$(objpath $SHA)" ' test_expect_success 'check rev-list' '
Signature · 1 line
2.16.1.464.gc4bae515b7
Re: [PATCH 1/1] Mark messages for translations
In reply to Jeff KingLet me repeat what you said so I know how to improve the patch:
@Junio:
Quoted 1 line
Perhaps end each sentence with a full-stop?
I should end each sentence in the *log* message with "." (rather than the translatable strings in the patch)
Quoted 2 lines
Shouldn't this rather be like so instead?
iftest_i18ngrep! "invalid gitfile format" .err
...
Quoted 1 line
These two ones want to be written
The standard negation form is:
test_i18ngrep !
but I should leave the ! in front of test_i18ngrep in this particular case
@Jeff:
Quoted 1 line
we may want to avoid this anti-pattern
Current state of these tests is wrong and I should rework them.
Here is what I intend to do:
1. Fix the commit message
2. Check whether I can get the tests in t0002-gitfile.sh to the standard test_i18ngrep ! negative (i.e. without using if)
3. Post and ask for feedback again
Kind regards:al_shopov
Re: [PATCH 1/1] Mark messages for translations
Quoted 9 lines · Alexander Shopov
@Jeff:
Quoted 1 line
we may want to avoid this anti-pattern
Current state of these tests is wrong and I should rework them.
Here is what I intend to do:
1. Fix the commit message
2. Check whether I can get the tests int0002-gitfile.shto the standardtest_i18ngrep !negative (i.e. without usingif)
3. Post and ask for feedback again
See the patch I posted earlier. For (2), "test_i18ngrep !" would be the wrong thing. I think you should either:
- keep your patch as-is, and let Junio resolve the conflict when the two are merged
- rebase your patch on top of mine. That's slightly less work for Junio, but it means that your topic cannot graduate until mine does (though hopefully mine is pretty non-controversial).
I'd probably just do the first in your place, since the conflict is easy to resolve.
-Peff
cover Mark messages for translation
Following suggestions on last email exchange:
Junio C Hamano
1. End sentences in long log message with '.'
2. Leave final merge fixes to him based on suggestion from Jeff King
Previous changes:
Eric Sunshine:
1. Use 'test_i18ngrep' rather than 'grep'
Jeff King:
2. Fix t1506
Johannes Sixt:
3. Lower-case letters at the beginning of error messages
4. Past tense to present tense in some cases
Eric Sunshine:
5. Fix -cname=value to say -c <name>=<value>
6. Do not translate "BUG message"
Duy Nguyen:
7. Fix parentheses on _ macro
Kind regards:al_shopov
Alexander Shopov (1):
Mark messages for translations
git.c | 38 +++++++++++++------------- setup.c | 62 +++++++++++++++++++++--------------------- t/t0002-gitfile.sh | 4 +-- t/t0008-ignores.sh | 2 +- t/t1506-rev-parse-diagnosis.sh | 2 +- 5 files changed, 54 insertions(+), 54 deletions(-)
Signature · 1 line
2.16.1
PATCH 1/1 Mark messages for translations
Small changes in messages to fit the style and typography of rest. Reuse already translated messages if possible.
Do not translate messages aimed at developers of git. Fix unit tests depending on the original string.
Use test_i18ngrep for tests with translatable strings. Change and verify rest of tests via make GETTEXT_POISON=1 test.
--- git.c | 38 +++++++++++++------------- setup.c | 62 +++++++++++++++++++++--------------------- t/t0002-gitfile.sh | 4 +-- t/t0008-ignores.sh | 2 +- t/t1506-rev-parse-diagnosis.sh | 2 +- 5 files changed, 54 insertions(+), 54 deletions(-)
git.c +19 -19
@@ -5,11 +5,11 @@#include "run-command.h" const char git_usage_string[] = -"git [--version] [--help] [-C <path>] [-c name=value]\n" -" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" -" [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n" -" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" -" <command> [<args>]" ; +N_ ("git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" +" [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n" +" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" +" <command> [<args>]" );const char git_more_info_string[] = N_("'git help -a' and 'git help -g' list available subcommands and some\n"
@@ -92,7 +92,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--git-dir" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for --git-dir.\n" ); +fprintf (stderr,_ ("no directory given for --git-dir\n" ));usage (git_usage_string); }setenv (GIT_DIR_ENVIRONMENT , (*argv)[1 ],1 );
@@ -106,7 +106,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--namespace" )) {if (*argc <2 ) { -fprintf (stderr,"No namespace given for --namespace.\n" ); +fprintf (stderr,_ ("no namespace given for --namespace\n" ));usage (git_usage_string); }setenv (GIT_NAMESPACE_ENVIRONMENT , (*argv)[1 ],1 );
@@ -120,7 +120,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--work-tree" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for --work-tree.\n" ); +fprintf (stderr,_ ("no directory given for --work-tree\n" ));usage (git_usage_string); }setenv (GIT_WORK_TREE_ENVIRONMENT , (*argv)[1 ],1 );
@@ -134,7 +134,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"--super-prefix" )) {if (*argc <2 ) { -fprintf (stderr,"No prefix given for --super-prefix.\n" ); +fprintf (stderr,_ ("no prefix given for --super-prefix\n" ));usage (git_usage_string); }setenv (GIT_SUPER_PREFIX_ENVIRONMENT , (*argv)[1 ],1 );
@@ -156,7 +156,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"-c" )) {if (*argc <2 ) { -fprintf (stderr,"-c expects a configuration string\n" ); +fprintf (stderr,_ ("-c expects a configuration string\n" ));usage (git_usage_string); }git_config_push_parameter ((*argv)[1 ]);
@@ -194,12 +194,12 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) *envchanged =1 ; }else if (!strcmp (cmd,"-C" )) {if (*argc <2 ) { -fprintf (stderr,"No directory given for -C.\n" ); +fprintf (stderr,_ ("no directory given for -C\n" ));usage (git_usage_string); }if ((*argv)[1 ][0 ]) {if (chdir ((*argv)[1 ])) -die_errno ("Cannot change to '%s'" , (*argv)[1 ]); +die_errno ("cannot change to '%s'" , (*argv)[1 ]);if (envchanged) *envchanged =1 ; }
@@ -209,7 +209,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)list_builtins ();exit (0 ); }else { -fprintf (stderr,"Unknown option: %s\n" , cmd); +fprintf (stderr,_ ("unknown option: %s\n" ), cmd);usage (git_usage_string); }
@@ -247,7 +247,7 @@ static int handle_alias(int *argcp, const char ***argv)if (ret >=0 )/* normal exit */ exit (ret); -die_errno ("While expanding alias '%s': '%s'" , +die_errno ("while expanding alias '%s': '%s'" , alias_command, alias_string +1 ); } count =split_cmdline (alias_string, &new_argv);
@@ -256,8 +256,8 @@ static int handle_alias(int *argcp, const char ***argv) split_cmdline_strerror(count)); option_count =handle_options (&new_argv, &count, &envchanged);if (envchanged) -die ("alias '%s' changes environment variables\n" -"You can use '!git' in the alias to do this." , +die ("alias '%s' changes environment variables.\n" +"You can use '!git' in the alias to do this" , alias_command);memmove (new_argv - option_count, new_argv, count *sizeof (char *));
@@ -684,8 +684,8 @@ int cmd_main(int argc, const char **argv)if (errno !=ENOENT )break ;if (was_alias) { -fprintf (stderr,"Expansion of alias '%s' failed; " -"'%s' is not a git command\n" , +fprintf (stderr,_ ("expansion of alias '%s' failed; " +"'%s' is not a git command\n" ), cmd, argv[0 ]);exit (1 ); }
@@ -696,7 +696,7 @@ int cmd_main(int argc, const char **argv)break ; } -fprintf (stderr,"Failed to run command '%s': %s\n" , +fprintf (stderr,_ ("failed to run command '%s': %s\n" ), cmd,strerror (errno));return 1 ;
setup.c +31 -31
206 lines not on this page · raw message
t/t0002-gitfile.sh +2 -2
@@ -31,7 +31,7 @@ test_expect_success 'bad setup: invalid .git file format' ' echo "git rev-parse accepted an invalid .git file" false fi && - if ! grep "Invalid gitfile format" .err + if ! test_i18ngrep "invalid gitfile format" .err then echo "git rev-parse returned wrong error" false
@@ -45,7 +45,7 @@ test_expect_success 'bad setup: invalid .git file path' ' echo "git rev-parse accepted an invalid .git file path" false fi && - if ! grep "Not a git repository" .err + if ! test_i18ngrep "not a git repository" .err then echo "git rev-parse returned wrong error" false
t/t0008-ignores.sh +1 -1
@@ -307,7 +307,7 @@ test_expect_success_multi 'needs work tree' '' ' cd .git && test_check_ignore "foo" 128 ) && - stderr_contains "fatal: This operation must be run in a work tree" + stderr_contains "fatal: this operation must be run in a work tree" ' ############################################################################
t/t1506-rev-parse-diagnosis.sh +1 -1
@@ -157,7 +157,7 @@ test_expect_success 'relative path not found' ' test_expect_success 'relative path outside worktree' ' test_must_fail git rev-parse HEAD:../file.txt >output 2>error && test -z "$(cat output)" && - grep "outside repository" error + test_i18ngrep "outside repository" error ' test_expect_success 'relative path when cwd is outside worktree' '
Signature · 1 line
2.16.1