i18n: mark missing C messages
cover i18n: mark missing C messages
Some messages fell through the cracks during the later submissions of the i18n series, hopefully this catches all of the remaining C messsages.
This is an RFC because the first patch still leaves one remaining gitdir test failing under GETTEXT_POISON, and I won't be able to find out why tonight. Help welcome with figuring out why (in which case this should all be OK), you just need too build with GETTEXT_POISON=YesPlease and run t/t0001-init.sh.
Ævar Arnfjörð Bjarmason (7):
i18n: mark init-db messages for translation
i18n: mark merge "Could not read from" message for translation
i18n: mark merge "upstream" messages for translation
i18n: mark merge CHERRY_PICK_HEAD messages for translation
i18n: mark clone nonexistent repository message for translation
i18n: mark checkout --detach messages for translation
i18n: mark checkout plural warning for translation
builtin/checkout.c | 24 ++++++++++++++++++------ builtin/clone.c | 2 +- builtin/init-db.c | 12 ++++++------ builtin/merge.c | 16 ++++++++-------- t/t0001-init.sh | 28 ++++++++++++++++++++-------- t/t2020-checkout-detach.sh | 15 ++++++++++++--- t/t5601-clone.sh | 7 +++++-- 7 files changed, 70 insertions(+), 34 deletions(-)
Signature · 1 line
1.7.4.1
PATCH 1/7 i18n: mark init-db messages for translation
Mark the init-db messages that were added in v1.7.5-rc1~16^2 (init,
clone: support --separate-git-dir for .git file) by Nguyễn Thái Ngọc Duy for translation.
This requires splitting up the tests that the patch added so that certain parts of them can be skipped unless the C_LOCALE_OUTPUT prerequisite is satisfied.
--- builtin/init-db.c | 12 ++++++------ t/t0001-init.sh | 28 ++++++++++++++++++++-------- t/t5601-clone.sh | 7 +++++-- 3 files changed, 31 insertions(+), 16 deletions(-)
builtin/init-db.c +6 -6
@@ -319,10 +319,10 @@ int set_git_dir_init(const char *git_dir, const char *real_git_dir,struct stat st;if (!exist_ok && !stat (git_dir, &st)) -die ("%s already exists" , git_dir); +die (_ ("%s already exists" ), git_dir);if (!exist_ok && !stat (real_git_dir, &st)) -die ("%s already exists" , real_git_dir); +die (_ ("%s already exists" ), real_git_dir);/* * make sure symlinks are resolved because we'll be
@@ -351,16 +351,16 @@ static void separate_git_dir(const char *git_dir)else if (S_ISDIR (st.st_mode)) src = git_link;else -die ("unable to handle file type %d" , st.st_mode); +die (_ ("unable to handle file type %d" ), st.st_mode);if (rename (src, git_dir)) -die_errno ("unable to move %s to %s" , src, git_dir); +die_errno (_ ("unable to move %s to %s" ), src, git_dir); } fp =fopen (git_link,"w" );if (!fp) -die ("Could not create git link %s" , git_link); -fprintf (fp,"gitdir: %s\n" , git_dir); +die (_ ("Could not create git link %s" ), git_link); +fprintf (fp,_ ("gitdir: %s\n" ), git_dir);fclose (fp); }
t/t0001-init.sh +20 -8
@@ -374,22 +374,28 @@ test_expect_success 'init prefers command line to GIT_DIR' ' test_expect_success 'init with separate gitdir' ' rm -rf newdir && git init --separate-git-dir realgitdir newdir && - echo "gitdir: `pwd`/realgitdir" >expected && - test_cmp expected newdir/.git && test -d realgitdir/refs ' +test_expect_success C_LOCALE_OUTPUT 'init with separate gitdir: output' ' + echo "gitdir: `pwd`/realgitdir" >expected && + test_cmp expected newdir/.git +' + test_expect_success 're-init to update git link' ' ( cd newdir && git init --separate-git-dir ../surrealgitdir ) && - echo "gitdir: `pwd`/surrealgitdir" >expected && - test_cmp expected newdir/.git && test -d surrealgitdir/refs && ! test -d realgitdir/refs ' +test_expect_success C_LOCALE_OUTPUT 're-init to update git link: output' ' + echo "gitdir: `pwd`/surrealgitdir" >expected && + test_cmp expected newdir/.git +' + test_expect_success 're-init to move gitdir' ' rm -rf newdir realgitdir surrealgitdir && git init newdir &&
@@ -397,11 +403,14 @@ test_expect_success 're-init to move gitdir' ' cd newdir && git init --separate-git-dir ../realgitdir ) && - echo "gitdir: `pwd`/realgitdir" >expected && - test_cmp expected newdir/.git && test -d realgitdir/refs ' +test_expect_success C_LOCALE_OUTPUT 're-init to move gitdir: output' ' + echo "gitdir: `pwd`/realgitdir" >expected && + test_cmp expected newdir/.git +' + test_expect_success 're-init to move gitdir symlink' ' rm -rf newdir realgitdir && git init newdir &&
@@ -411,10 +420,13 @@ test_expect_success 're-init to move gitdir symlink' ' ln -s here .git && git init -L ../realgitdir ) && - echo "gitdir: `pwd`/realgitdir" >expected && - test_cmp expected newdir/.git && test -d realgitdir/refs && ! test -d newdir/here ' +test_expect_success C_LOCALE_OUTPUT 're-init to move gitdir symlink: output' ' + echo "gitdir: `pwd`/realgitdir" >expected && + test_cmp expected newdir/.git +' + test_done
t/t5601-clone.sh +5 -2
@@ -194,11 +194,14 @@ test_expect_success 'do not respect url-encoding of non-url path' ' test_expect_success 'clone separate gitdir' ' rm -rf dst && git clone --separate-git-dir realgitdir src dst && - echo "gitdir: `pwd`/realgitdir" >expected && - test_cmp expected dst/.git && test -d realgitdir/refs ' +test_expect_success C_LOCALE_OUTPUT 'clone separate gitdir: output' ' + echo "gitdir: `pwd`/realgitdir" >expected && + test_cmp expected dst/.git +' + test_expect_success 'clone separate gitdir where target already exists' ' rm -rf dst && test_must_fail git clone --separate-git-dir realgitdir src dst
Signature · 1 line
1.7.4.1
Re: [PATCH/RFC 1/7] i18n: mark init-db messages for translation
Quoted 16 lines · Ævar Arnfjörð Bjarmason
builtin/init-db.c +2
-2fp =fopen (git_link,"w" );if (!fp) -die ("Could not create git link %s" , git_link); -fprintf (fp,"gitdir: %s\n" , git_dir); +die (_ ("Could not create git link %s" ), git_link); +fprintf (fp,_ ("gitdir: %s\n" ), git_dir);fclose (fp); }t/t0001-init.sh +0
-0@@ -374,22 +374,28 @@ test_expect_success 'init prefers command line to GIT_DIR' ' test_expect_success 'init with separate gitdir' ' rm -rf newdir &&
t/t0001-init.sh test_expect_success 'init prefers command line to GIT_DIR' ' · line 383
Quoted 10 lines
t/t0001-init.sh +4
-2git init --separate-git-dir realgitdir newdir && - echo "gitdir: `pwd`/realgitdir" >expected && - test_cmp expected newdir/.git && test -d realgitdir/refs ' +test_expect_success C_LOCALE_OUTPUT 'init with separate gitdir: output' ' + echo "gitdir: `pwd`/realgitdir" >expected && + test_cmp expected newdir/.git +'
I don't think this is correct. The file "git_link" refers to .git that is not a directory but is a regular file whose contents is "gitdir: $path" and that should _never_ be localized, so the patch to die() message is Ok, but the string given to fprintf(fp, ...) is _not_.
And t0001 should compare the expected output with "gitdir: $path" regardless of the poisoning.
Re: [PATCH/RFC 1/7] i18n: mark init-db messages for translation
Quoted 14 lines · Junio C Hamano
builtin/init-db.c static void separate_git_dir(const char *git_dir) · line 364
Quoted 8 lines · Ævar Arnfjörð Bjarmason
builtin/init-db.c +2
-2fp =fopen (git_link,"w" );if (!fp) -die ("Could not create git link %s" , git_link); -fprintf (fp,"gitdir: %s\n" , git_dir); +die (_ ("Could not create git link %s" ), git_link); +fprintf (fp,_ ("gitdir: %s\n" ), git_dir);fclose (fp);I don't think this is correct. The file "
git_link" refers to .git that is not a directory but is a regular file whose contents is "gitdir: $path" and that should _never_ be localized, so the patch todie()message is Ok, but the string given tofprintf(fp, ...)is _not_.
See read_gitfile_gently() in setup.c; that is the reader of the information contained in this file.
Re: [PATCH/RFC 1/7] i18n: mark init-db messages for translation
Quoted 12 lines · Junio C Hamano
Quoted 10 lines · Junio C Hamano
Quoted 8 lines · Ævar Arnfjörð Bjarmason
fp =
fopen(git_link, "w");
if (!fp)
- die("Could not create git link %s",git_link);
- fprintf(fp, "gitdir: %s\n",git_dir);
+ die(_("Could not create git link %s"),git_link);
+ fprintf(fp,_("gitdir: %s\n"),git_dir); fclose(fp);
...
Quoted 7 lines
Quoted 4 lines
I don't think this is correct. The file "
git_link" refers to .git that is not a directory but is a regular file whose contents is "gitdir: $path" and that should _never_ be localized, so the patch todie()message is Ok, but the string given tofprintf(fp, ...)is _not_.See
read_gitfile_gently()insetup.c; that is the reader of the information contained in this file.
Ah, thanks. Missed that. I'd have spotted it if I dug down instead of sending.
I'll re-send one without the translation for this plumbing message.
Re: [PATCH/RFC 1/7] i18n: mark init-db messages for translation
Quoted 3 lines · Ævar Arnfjörð Bjarmason
Ah, thanks. Missed that. I'd have spotted it if I dug down instead of sending.
I'll re-send one without the translation for this plumbing message.
No need to resend, if the reroll is just the removal of the part that marks the fprintf() argument, and sprinkles t0001 with C_LOCALE_OUTPUT to skip checking of the contents of .git file.
By the way, don't you think the attached is far easier to read than artificially breaking a single test into "do" and "check" phase? The majority of the l10n dependent tests can and should lose C_LOCALE_OUTPUT prerequisite and use this instead for far superiour readability, I think.
At least this makes it far more pleasant to read both the actual script and the output in non-poison cases.
t/test-lib.sh | 8 ++++ t/t5526-fetch-submodules.sh | 93 ++++++++++++++++-------------------------- 2 files changed, 44 insertions(+), 57 deletions(-)
t/test-lib.sh +8 -0
@@ -1077,6 +1077,14 @@ else test_set_prereq C_LOCALE_OUTPUT fi +# Use this instead of test_cmp to compare files that contain expected and +# actual output from git commands that can be translated. When running +# under GETTEXT_POISON this pretends that the command produced expected +# results. +test_i18ncmp () { + test -n "$GETTEXT_POISON" || test_cmp "$@" +} + # test whether the filesystem supports symbolic links ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS rm -f y
t/t5526-fetch-submodules.sh +36 -57
189 lines not on this page · raw message
Re: [PATCH/RFC 1/7] i18n: mark init-db messages for translation
Quoted 7 lines · Junio C Hamano
By the way, don't you think the attached is far easier to read than artificially breaking a single test into "do" and "check" phase? The majority of the l10n dependent tests can and should lose
C_LOCALE_OUTPUTprerequisite and use this instead for far superiour readability, I think.At least this makes it far more pleasant to read both the actual script and the output in non-poison cases.
And this is for the other common pattern: use grep to find expected string.
t/test-lib.sh | 8 ++++++++ t/t0001-init.sh | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-)
t/test-lib.sh +8 -0
@@ -1085,6 +1085,14 @@ test_i18ncmp () { test -n "$GETTEXT_POISON" || test_cmp "$@" } +# Use this instead of "grep expected-string actual" to see if the +# output from a git command that acn be translated contains an +# expected string. When running under GETTEXT_POISON this pretends +# that the command produced expected results. +test_i18ngrep () { + test -n "$GETTEXT_POISON" || grep "$@" +} + # test whether the filesystem supports symbolic links ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS rm -f y
t/t0001-init.sh +5 -5
@@ -180,7 +180,7 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' ' fi ' -test_expect_success C_LOCALE_OUTPUT 'reinit' ' +test_expect_success 'reinit' ' ( sane_unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG &&
@@ -190,11 +190,11 @@ test_expect_success C_LOCALE_OUTPUT 'reinit' ' git init >out1 2>err1 && git init >out2 2>err2 ) && - grep "Initialized empty" again/out1 && - grep "Reinitialized existing" again/out2 && + test_i18ngrep "Initialized empty" again/out1 && + test_i18ngrep "Reinitialized existing" again/out2 && >again/empty && - test_cmp again/empty again/err1 && - test_cmp again/empty again/err2 + test_i18ncmp again/empty again/err1 && + test_i18ncmp again/empty again/err2 ' test_expect_success 'init with --template' '
Re: [PATCH/RFC 1/7] i18n: mark init-db messages for translation
Review
Quoted 8 lines · Junio C Hamano
(quoted diff) +8
-0+# Use this instead of "grep expected-string actual" to see if the +# output from a git command that acn be translated contains an +# expected string. When running under GETTEXT_POISON this pretends +# that the command produced expected results. +test_i18ngrep () { + test -n "$GETTEXT_POISON" || grep "$@" +} +
I spoke too early.
The common pattern is either to ensure that the actual output has an expected string, of to ensure that the actual output does not have an unwanted string. So this has to be something like:
t/test-lib.sh +17 -0
@@ -1085,6 +1085,23 @@ test_i18ncmp () { test -n "$GETTEXT_POISON" || test_cmp "$@" } +# Use this instead of "grep expected-string actual" to see if the +# output from a git command that can be translated contains (or does +# not contain) an expected string. When running under GETTEXT_POISON +# this pretends that the command produced expected results. +test_i18ngrep () { + if test -n "$GETTEXT_POISON" + then + : # pretend success + elif test "x!" = "x$1" + then + shift + ! grep "$@" + else + grep "$@" + fi +} + # test whether the filesystem supports symbolic links ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS rm -f y
t/t2019-checkout-ambiguous-ref.sh +3 -3
@@ -29,9 +29,9 @@ test_expect_success 'checkout chooses branch over tag' ' test_cmp expect file ' -test_expect_success C_LOCALE_OUTPUT 'checkout reports switch to branch' ' - grep "Switched to branch" stderr && - ! grep "^HEAD is now at" stderr +test_expect_success 'checkout reports switch to branch' ' + test_i18ngrep "Switched to branch" stderr && + test_i18ngrep ! "^HEAD is now at" stderr ' test_expect_success 'checkout vague ref succeeds' '
PATCH 1/1 i18n: use test_i18n{grep,cmp} in t7508
Two tests looked for "[Uu]sage" in the output, but we cannot expect the l10n to use that phrase. Mark them with test_i18ngrep so that in later versions we can test truly localized versions with the same tests, not just GETTEXT_POISON that happens to keep the original string in the output.
Merge a few tests that were artificially split into "do" and "test output under C_LOCALE_OUTPUT" in the original i18n patches back.
---
* I've queued many others in 'pu' without sending them on the list, but this one is a bit different and can use extra sets of eyeballs, so...
t/t7508-status.sh | 222 ++++++++++++++++++++++++----------------------------- 1 files changed, 102 insertions(+), 120 deletions(-)
t/t7508-status.sh +102 -120
@@ -16,7 +16,7 @@ test_expect_success 'status -h in broken repository' ' echo "[status] showuntrackedfiles = CORRUPT" >>.git/config && test_expect_code 129 git status -h >usage 2>&1 ) && - grep "[Uu]sage" broken/usage + test_i18ngrep "[Uu]sage" broken/usage ' test_expect_success 'commit -h in broken repository' '
@@ -28,7 +28,7 @@ test_expect_success 'commit -h in broken repository' ' echo "[status] showuntrackedfiles = CORRUPT" >>.git/config && test_expect_code 129 git commit -h >usage 2>&1 ) && - grep "[Uu]sage" broken/usage + test_i18ngrep "[Uu]sage" broken/usage ' test_expect_success 'setup' '
@@ -55,10 +55,8 @@ test_expect_success 'setup' ' git add dir2/added ' -test_expect_success C_LOCALE_OUTPUT 'status (1)' ' - - grep "use \"git rm --cached <file>\.\.\.\" to unstage" output - +test_expect_success 'status (1)' ' + test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output ' cat >expect <<\EOF
@@ -85,11 +83,9 @@ cat >expect <<\EOF # untracked EOF -test_expect_success C_LOCALE_OUTPUT 'status (2)' ' - +test_expect_success 'status (2)' ' git status >output && - test_cmp expect output - + test_i18ncmp expect output ' cat >expect <<\EOF
@@ -109,17 +105,14 @@ cat >expect <<\EOF # untracked EOF -git config advice.statusHints false - -test_expect_success C_LOCALE_OUTPUT 'status (advice.statusHints false)' ' - +test_expect_success 'status (advice.statusHints false)' ' + test_when_finished "git config --unset advice.statusHints" && + git config advice.statusHints false && git status >output && - test_cmp expect output + test_i18ncmp expect output ' -git config --unset advice.statusHints - cat >expect <<\EOF M dir1/modified A dir2/added
@@ -178,16 +171,16 @@ cat >expect <<EOF # # Untracked files not listed (use -u option to show untracked files) EOF -test_expect_success C_LOCALE_OUTPUT 'status -uno' ' +test_expect_success 'status -uno' ' git status -uno >output && - test_cmp expect output + test_i18ncmp expect output ' -test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles no)' ' +test_expect_success 'status (status.showUntrackedFiles no)' ' git config status.showuntrackedfiles no test_when_finished "git config --unset status.showuntrackedfiles" && git status >output && - test_cmp expect output + test_i18ncmp expect output ' cat >expect <<EOF
@@ -201,9 +194,9 @@ cat >expect <<EOF # Untracked files not listed EOF git config advice.statusHints false -test_expect_success C_LOCALE_OUTPUT 'status -uno (advice.statusHints false)' ' +test_expect_success 'status -uno (advice.statusHints false)' ' git status -uno >output && - test_cmp expect output + test_i18ncmp expect output ' git config --unset advice.statusHints
@@ -246,16 +239,16 @@ cat >expect <<EOF # output # untracked EOF -test_expect_success C_LOCALE_OUTPUT 'status -unormal' ' +test_expect_success 'status -unormal' ' git status -unormal >output && - test_cmp expect output + test_i18ncmp expect output ' -test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles normal)' ' +test_expect_success 'status (status.showUntrackedFiles normal)' ' git config status.showuntrackedfiles normal test_when_finished "git config --unset status.showuntrackedfiles" && git status >output && - test_cmp expect output + test_i18ncmp expect output ' cat >expect <<EOF
@@ -305,15 +298,16 @@ cat >expect <<EOF # output # untracked EOF -test_expect_success C_LOCALE_OUTPUT 'status -uall' ' +test_expect_success 'status -uall' ' git status -uall >output && - test_cmp expect output + test_i18ncmp expect output ' -test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles all)' ' + +test_expect_success 'status (status.showUntrackedFiles all)' ' git config status.showuntrackedfiles all test_when_finished "git config --unset status.showuntrackedfiles" && git status >output && - test_cmp expect output + test_i18ncmp expect output ' test_expect_success 'teardown dir3' '
@@ -367,11 +361,9 @@ cat >expect <<\EOF # ../untracked EOF -test_expect_success C_LOCALE_OUTPUT 'status with relative paths' ' - +test_expect_success 'status with relative paths' ' (cd dir1 && git status) >output && - test_cmp expect output - + test_i18ncmp expect output ' cat >expect <<\EOF
@@ -440,22 +432,18 @@ cat >expect <<\EOF # <BLUE>untracked<RESET> EOF -test_expect_success C_LOCALE_OUTPUT 'status with color.ui' ' - +test_expect_success 'status with color.ui' ' git config color.ui always && test_when_finished "git config --unset color.ui" && git status | test_decode_color >output && - test_cmp expect output - + test_i18ncmp expect output ' -test_expect_success C_LOCALE_OUTPUT 'status with color.status' ' - +test_expect_success 'status with color.status' ' git config color.status always && test_when_finished "git config --unset color.status" && git status | test_decode_color >output && - test_cmp expect output - + test_i18ncmp expect output ' cat >expect <<\EOF
@@ -570,12 +558,12 @@ cat >expect <<\EOF EOF -test_expect_success C_LOCALE_OUTPUT 'status without relative paths' ' +test_expect_success 'status without relative paths' ' git config status.relativePaths false && test_when_finished "git config --unset status.relativePaths" && (cd dir1 && git status) >output && - test_cmp expect output + test_i18ncmp expect output '
@@ -616,11 +604,8 @@ cat <<EOF >expect # untracked EOF test_expect_success 'dry-run of partial commit excluding new file in index' ' - git commit --dry-run dir1/modified >output -' - -test_expect_success C_LOCALE_OUTPUT 'dry-run of partial commit excluding new file in index: output' ' - test_cmp expect output + git commit --dry-run dir1/modified >output && + test_i18ncmp expect output ' cat >expect <<EOF
@@ -667,15 +652,15 @@ cat >expect <<EOF # output # untracked EOF -test_expect_success C_LOCALE_OUTPUT 'status submodule summary is disabled by default' ' +test_expect_success 'status submodule summary is disabled by default' ' git status >output && - test_cmp expect output + test_i18ncmp expect output ' # we expect the same as the previous test -test_expect_success C_LOCALE_OUTPUT 'status --untracked-files=all does not show submodule' ' +test_expect_success 'status --untracked-files=all does not show submodule' ' git status --untracked-files=all >output && - test_cmp expect output + test_i18ncmp expect output ' cat >expect <<EOF
@@ -731,10 +716,10 @@ cat >expect <<EOF # output # untracked EOF -test_expect_success C_LOCALE_OUTPUT 'status submodule summary' ' +test_expect_success 'status submodule summary' ' git config status.submodulesummary 10 && git status >output && - test_cmp expect output + test_i18ncmp expect output ' cat >expect <<EOF
@@ -773,15 +758,12 @@ cat >expect <<EOF no changes added to commit (use "git add" and/or "git commit -a") EOF test_expect_success 'status submodule summary (clean submodule): commit' ' - git commit -m "commit submodule" -' - -test_expect_success C_LOCALE_OUTPUT 'status submodule summary (clean submodule): output' ' + git commit -m "commit submodule" && git config status.submodulesummary 10 && test_must_fail git commit --dry-run >output && - test_cmp expect output && + test_i18ncmp expect output && git status >output && - test_cmp expect output + test_i18ncmp expect output ' cat >expect <<EOF
@@ -827,10 +809,10 @@ cat >expect <<EOF # output # untracked EOF -test_expect_success C_LOCALE_OUTPUT 'commit --dry-run submodule summary (--amend)' ' +test_expect_success 'commit --dry-run submodule summary (--amend)' ' git config status.submodulesummary 10 && git commit --dry-run --amend >output && - test_cmp expect output + test_i18ncmp expect output ' test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
@@ -882,84 +864,84 @@ cat > expect << EOF # untracked EOF -test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=untracked suppresses submodules with untracked content' ' - echo modified > sm/untracked && - git status --ignore-submodules=untracked > output && - test_cmp expect output +test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' ' + echo modified sm/untracked && + git status --ignore-submodules=untracked >output && + test_i18ncmp expect output ' -test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=untracked suppresses submodules with untracked content' ' +test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' ' git config diff.ignoreSubmodules dirty && git status >output && - test_cmp expect output && + test_i18ncmp expect output && git config --add -f .gitmodules submodule.subname.ignore untracked && git config --add -f .gitmodules submodule.subname.path sm && - git status > output && - test_cmp expect output && + git status >output && + test_i18ncmp expect output && git config -f .gitmodules --remove-section submodule.subname && git config --unset diff.ignoreSubmodules ' -test_expect_success C_LOCALE_OUTPUT '.git/config ignore=untracked suppresses submodules with untracked content' ' +test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' ' git config --add -f .gitmodules submodule.subname.ignore none && git config --add -f .gitmodules submodule.subname.path sm && git config --add submodule.subname.ignore untracked && git config --add submodule.subname.path sm && - git status > output && - test_cmp expect output && + git status >output && + test_i18ncmp expect output && git config --remove-section submodule.subname && git config --remove-section -f .gitmodules submodule.subname ' -test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=dirty suppresses submodules with untracked content' ' - git status --ignore-submodules=dirty > output && - test_cmp expect output +test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' ' + git status --ignore-submodules=dirty >output && + test_i18ncmp expect output ' -test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with untracked content' ' +test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' ' git config diff.ignoreSubmodules dirty && git status >output && ! test -s actual && git config --add -f .gitmodules submodule.subname.ignore dirty && git config --add -f .gitmodules submodule.subname.path sm && - git status > output && - test_cmp expect output && + git status >output && + test_i18ncmp expect output && git config -f .gitmodules --remove-section submodule.subname && git config --unset diff.ignoreSubmodules ' -test_expect_success C_LOCALE_OUTPUT '.git/config ignore=dirty suppresses submodules with untracked content' ' +test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' ' git config --add -f .gitmodules submodule.subname.ignore none && git config --add -f .gitmodules submodule.subname.path sm && git config --add submodule.subname.ignore dirty && git config --add submodule.subname.path sm && - git status > output && - test_cmp expect output && + git status >output && + test_i18ncmp expect output && git config --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname ' -test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=dirty suppresses submodules with modified content' ' - echo modified > sm/foo && - git status --ignore-submodules=dirty > output && - test_cmp expect output +test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' ' + echo modified >sm/foo && + git status --ignore-submodules=dirty >output && + test_i18ncmp expect output ' -test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with modified content' ' +test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' ' git config --add -f .gitmodules submodule.subname.ignore dirty && git config --add -f .gitmodules submodule.subname.path sm && - git status > output && - test_cmp expect output && + git status >output && + test_i18ncmp expect output && git config -f .gitmodules --remove-section submodule.subname ' -test_expect_success C_LOCALE_OUTPUT '.git/config ignore=dirty suppresses submodules with modified content' ' +test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' ' git config --add -f .gitmodules submodule.subname.ignore none && git config --add -f .gitmodules submodule.subname.path sm && git config --add submodule.subname.ignore dirty && git config --add submodule.subname.path sm && - git status > output && - test_cmp expect output && + git status >output && + test_i18ncmp expect output && git config --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname '
@@ -996,26 +978,26 @@ cat > expect << EOF # untracked EOF -test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodules with modified content" ' +test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" ' git status --ignore-submodules=untracked > output && - test_cmp expect output + test_i18ncmp expect output ' -test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=untracked doesn't suppress submodules with modified content" ' +test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" ' git config --add -f .gitmodules submodule.subname.ignore untracked && git config --add -f .gitmodules submodule.subname.path sm && - git status > output && - test_cmp expect output && + git status >output && + test_i18ncmp expect output && git config -f .gitmodules --remove-section submodule.subname ' -test_expect_success C_LOCALE_OUTPUT ".git/config ignore=untracked doesn't suppress submodules with modified content" ' +test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" ' git config --add -f .gitmodules submodule.subname.ignore none && git config --add -f .gitmodules submodule.subname.path sm && git config --add submodule.subname.ignore untracked && git config --add submodule.subname.path sm && - git status > output && - test_cmp expect output && + git status >output && + test_i18ncmp expect output && git config --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname '
@@ -1058,49 +1040,49 @@ cat > expect << EOF # untracked EOF -test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodule summary" ' +test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" ' git status --ignore-submodules=untracked > output && - test_cmp expect output + test_i18ncmp expect output ' -test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=untracked doesn't suppress submodule summary" ' +test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" ' git config --add -f .gitmodules submodule.subname.ignore untracked && git config --add -f .gitmodules submodule.subname.path sm && - git status > output && - test_cmp expect output && + git status >output && + test_i18ncmp expect output && git config -f .gitmodules --remove-section submodule.subname ' -test_expect_success C_LOCALE_OUTPUT ".git/config ignore=untracked doesn't suppress submodule summary" ' +test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" ' git config --add -f .gitmodules submodule.subname.ignore none && git config --add -f .gitmodules submodule.subname.path sm && git config --add submodule.subname.ignore untracked && git config --add submodule.subname.path sm && - git status > output && - test_cmp expect output && + git status >output && + test_i18ncmp expect output && git config --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname ' -test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=dirty doesn't suppress submodule summary" ' +test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" ' git status --ignore-submodules=dirty > output && - test_cmp expect output + test_i18ncmp expect output ' -test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=dirty doesn't suppress submodule summary" ' +test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" ' git config --add -f .gitmodules submodule.subname.ignore dirty && git config --add -f .gitmodules submodule.subname.path sm && - git status > output && - test_cmp expect output && + git status >output && + test_i18ncmp expect output && git config -f .gitmodules --remove-section submodule.subname ' -test_expect_success C_LOCALE_OUTPUT ".git/config ignore=dirty doesn't suppress submodule summary" ' +test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" ' git config --add -f .gitmodules submodule.subname.ignore none && git config --add -f .gitmodules submodule.subname.path sm && git config --add submodule.subname.ignore dirty && git config --add submodule.subname.path sm && - git status > output && - test_cmp expect output && + git status >output && + test_i18ncmp expect output && git config --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname '
@@ -1126,9 +1108,9 @@ cat > expect << EOF no changes added to commit (use "git add" and/or "git commit -a") EOF -test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=all suppresses submodule summary" ' +test_expect_success "--ignore-submodules=all suppresses submodule summary" ' git status --ignore-submodules=all > output && - test_cmp expect output + test_i18ncmp expect output ' test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '
PATCH 2/7 i18n: mark merge "Could not read from" message for translation
In reply to Ævar Arnfjörð BjarmasonMark the "Could not read from '%s'" message that was added to builtin/merge.c in v1.7.4.2~25^2 (merge: honor prepare-commit-msg hook) by Jay Soffian for translation.
--- builtin/merge.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
builtin/merge.c +1 -1
@@ -822,7 +822,7 @@ static void read_merge_msg(void) {strbuf_reset (&merge_msg);if (strbuf_read_file (&merge_msg,git_path ("MERGE_MSG" ),0 ) <0 ) -die_errno ("Could not read from '%s'" ,git_path ("MERGE_MSG" )); +die_errno (_ ("Could not read from '%s'" ),git_path ("MERGE_MSG" )); }static void run_prepare_commit_msg (void )
Signature · 1 line
1.7.4.1
PATCH 3/7 i18n: mark merge "upstream" messages for translation
In reply to Ævar Arnfjörð BjarmasonMark the merge messages that were added in v1.7.5-rc1~17^2 (merge:
merge with the default upstream branch without argument) by Junio C Hamano for translation.
--- builtin/merge.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
builtin/merge.c +4 -4
@@ -962,16 +962,16 @@ static int setup_with_upstream(const char ***argv)const char **args;if (!branch) -die ("No current branch." ); +die (_ ("No current branch." ));if (!branch->remote) -die ("No remote for the current branch." ); +die (_ ("No remote for the current branch." ));if (!branch->merge_nr) -die ("No default upstream defined for the current branch." ); +die (_ ("No default upstream defined for the current branch." )); args =xcalloc (branch->merge_nr +1 ,sizeof (char *));for (i =0 ; i < branch->merge_nr; i++) {if (!branch->merge[i]->dst) -die ("No remote tracking branch for %s from %s" , +die (_ ("No remote tracking branch for %s from %s" ), branch->merge[i]->src, branch->remote_name); args[i] = branch->merge[i]->dst; }
Signature · 1 line
1.7.4.1
PATCH 4/7 i18n: mark merge CHERRY_PICK_HEAD messages for translation
In reply to Ævar Arnfjörð BjarmasonMark CHERRY_PICK_HEAD related messages in builtin/merge.c that were added in v1.7.5-rc0~88^2~2 (Introduce CHERRY_PICK_HEAD) by Jay Soffian for translation.
--- builtin/merge.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
builtin/merge.c +3 -3
@@ -1043,10 +1043,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix) }if (file_exists (git_path ("CHERRY_PICK_HEAD" ))) {if (advice_resolve_conflict) -die ("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n" -"Please, commit your changes before you can merge." ); +die (_ ("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n" +"Please, commit your changes before you can merge." ));else -die ("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists)." ); +die (_ ("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists)." )); }resolve_undo_clear ();
Signature · 1 line
1.7.4.1
PATCH 5/7 i18n: mark clone nonexistent repository message for translation
In reply to Ævar Arnfjörð BjarmasonMark the "repository '%s' does not exist" message added in v1.7.4.2~21^2 (clone: die when trying to clone missing local path) by Jeff King for translation.
--- builtin/clone.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
builtin/clone.c +1 -1
@@ -417,7 +417,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)if (path) repo =xstrdup (absolute_path (repo_name));else if (!strchr (repo_name,':' )) -die ("repository '%s' does not exist" , repo_name); +die (_ ("repository '%s' does not exist" ), repo_name);else repo = repo_name; is_local = path && !is_bundle;
Signature · 1 line
1.7.4.1
PATCH 6/7 i18n: mark checkout --detach messages for translation
In reply to Ævar Arnfjörð BjarmasonMark messages added in v1.7.5-rc0~117^2~2 (checkout: introduce --detach synonym for "git checkout foo^{commit}") by Junio C Hamano for translation.
--- builtin/checkout.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
builtin/checkout.c +3 -3
@@ -961,9 +961,9 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)die (_ ("--patch is incompatible with all other options" ));if (opts.force_detach && (opts.new_branch || opts.new_orphan_branch)) -die ("--detach cannot be used with -b/-B/--orphan" ); +die (_ ("--detach cannot be used with -b/-B/--orphan" ));if (opts.force_detach &&0 < opts.track) -die ("--detach cannot be used with -t" ); +die (_ ("--detach cannot be used with -t" ));/* --track without -b should DWIM */ if (0 < opts.track && !opts.new_branch) {
@@ -1043,7 +1043,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) }if (opts.force_detach) -die ("git checkout: --detach does not take a path argument" ); +die (_ ("git checkout: --detach does not take a path argument" ));if (1 < !!opts.writeout_stage + !!opts.force + !!opts.merge)die (_ ("git checkout: --ours/--theirs, --force and --merge are incompatible when\nchecking out of the index." ));
Signature · 1 line
1.7.4.1
PATCH 7/7 i18n: mark checkout plural warning for translation
In reply to Ævar Arnfjörð BjarmasonMark the "Warning: you are leaving %d commit(s) behind" message added in v1.7.5-rc0~74^2 (commit: give final warning when reattaching HEAD to leave commits behind) by Junio C Hamano for translation.
This message requires the use of ngettext() features, and is the first message to use the Q_() wrapper around ngettext().
--- builtin/checkout.c | 18 +++++++++++++++--- t/t2020-checkout-detach.sh | 15 ++++++++++++--- 2 files changed, 27 insertions(+), 6 deletions(-)
builtin/checkout.c +15 -3
@@ -648,18 +648,30 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)if (more ==1 )describe_one_orphan (&sb, last);else -strbuf_addf (&sb," ... and %d more.\n" , more); +strbuf_addf (&sb,_ (" ... and %d more.\n" ), more); }fprintf (stderr, -"Warning: you are leaving %d commit%s behind, " +Q_ ( +/* The singular version */ +"Warning: you are leaving %d commit behind, " "not connected to\n" "any of your branches:\n\n" "%s\n" "If you want to keep them by creating a new branch, " "this may be a good time\nto do so with:\n\n" " git branch new_branch_name %s\n\n" , - lost, ((1 < lost) ?"s" :"" ), +/* The plural version */ +"Warning: you are leaving %d commits behind, " +"not connected to\n" +"any of your branches:\n\n" +"%s\n" +"If you want to keep them by creating a new branch, " +"this may be a good time\nto do so with:\n\n" +" git branch new_branch_name %s\n\n" , +/* Give ngettext() the count */ + lost), + lost, sb.buf,sha1_to_hex (commit->object.sha1));strbuf_release (&sb);
t/t2020-checkout-detach.sh +12 -3
@@ -108,21 +108,30 @@ test_expect_success 'checkout warns on orphan commits' ' echo content >orphan && git add orphan && git commit -a -m orphan && - git checkout master 2>stderr && + git checkout master 2>stderr +' + +test_expect_success C_LOCALE_OUTPUT 'checkout warns on orphan commits: output' ' check_orphan_warning stderr ' test_expect_success 'checkout does not warn leaving ref tip' ' reset && git checkout --detach two && - git checkout master 2>stderr && + git checkout master 2>stderr +' + +test_expect_success C_LOCALE_OUTPUT 'checkout does not warn leaving ref tip' ' check_no_orphan_warning stderr ' test_expect_success 'checkout does not warn leaving reachable commit' ' reset && git checkout --detach HEAD^ && - git checkout master 2>stderr && + git checkout master 2>stderr +' + +test_expect_success C_LOCALE_OUTPUT 'checkout does not warn leaving reachable commit' ' check_no_orphan_warning stderr '
Signature · 1 line
1.7.4.1
Re: [PATCH/RFC 7/7] i18n: mark checkout plural warning for translation
Quoted 6 lines · Ævar Arnfjörð Bjarmason
Mark the "Warning: you are leaving %d commit(s) behind" message added in v1.7.5-rc0~74^2 (commit: give final warning when reattaching HEAD to leave commits behind) by Junio C Hamano for translation.
This message requires the use of
ngettext()features, and is the first message to use theQ_()wrapper aroundngettext().
Thanks.
builtin/checkout.c static void suggest_reattach(struct commit *commit, struct rev_info *revs) · line 661
Quoted 8 lines
builtin/checkout.c +3
-0fprintf(stderr, + Q_( + /* The singular version */ + "Warning: you are leaving %d commit behind, " "not connected to\n" "any of your branches:\n\n" "%s\n" "If you want to keep them by creating a new branch, "
s/them/it/ as this is a singular case, no?
Re: [PATCH/RFC 7/7] i18n: mark checkout plural warning for translation
Quoted 20 lines · Junio C Hamano
Quoted 6 lines · Ævar Arnfjörð Bjarmason
Mark the "Warning: you are leaving %d commit(s) behind" message added in v1.7.5-rc0~74^2 (commit: give final warning when reattaching HEAD to leave commits behind) by Junio C Hamano for translation.
This message requires the use of
ngettext()features, and is the first message to use theQ_()wrapper aroundngettext().Thanks.
Quoted 8 lines
fprintf(stderr,
+ Q_(
+ /* The singular version */
+ "Warning: you are leaving %d commit behind, " "not connected to\n"
"any of your branches:\n\n"
"%s\n"
"If you want to keep them by creating a new branch, "
Quoted 1 line
s/them/it/ as this is a singular case, no?
I just used the message as-is, we were using that for the singular before.
But maybe we should change that. Fix it up at your discretion.
Re: [PATCH/RFC 7/7] i18n: mark checkout plural warning for translation
Quoted 7 lines · Ævar Arnfjörð Bjarmason
Quoted 5 lines
Quoted 3 lines
+ "Warning: you are leaving %d commit behind, "
...
"If you want to keep them by creating a new branch, "s/them/it/ as this is a singular case, no?
I just used the message as-is, we were using that for the singular before.
Heh, you cannot claim innocence in this case; it used to be "leaving %d commit(s) behind, ... if you want _them_", which was consistent with the earlier use of "commit(s)" ;-).
Re: [PATCH/RFC 7/7] i18n: mark checkout plural warning for translation
Quoted 6 lines · Junio C Hamano
Quoted 4 lines · Ævar Arnfjörð Bjarmason
Quoted 4 lines
Quoted 3 lines
+ "Warning: you are leaving %d commit behind, "
...
"If you want to keep them by creating a new branch, "
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
s/them/it/ as this is a singular case, no?
I just used the message as-is, we were using that for the singular before.
Heh, you cannot claim innocence in this case; it used to be "leaving %d commit(s) behind, ... if you want _them_", which was consistent with the earlier use of "commit(s)" ;-).
No, it was:
"Warning: you are leaving %d commit%s behind, "
[...]
lost, ((1 < lost) ? "s" : "")So it would be "commit" or "commits" depending on the value of the "lost" variable.
Anyway I could re-submit this or you could fix it up, either is fine by me.
Re: [PATCH/RFC 7/7] i18n: mark checkout plural warning for translation
Quoted 1 line · Ævar Arnfjörð Bjarmason
Anyway I could re-submit this or you could fix it up, either is fine by me.
Thanks. I've queued a fixup together with the test_i18ncmp changes in 'pu'.
Quoted 5 lines · Ævar Arnfjörð Bjarmason
This is an RFC because the first patch still leaves one remaining gitdir test failing under
GETTEXT_POISON, and I won't be able to find out why tonight. Help welcome with figuring out why (in which case this should all be OK), you just need too build with GETTEXT_POISON=YesPlease and runt/t0001-init.sh.
I didn't even compile test this one, but I highly suspect that all the failures you saw come from the fact that .git file your patch produces with gettext poisoning (or any l10n) would be malformed and cannot be parsed by read_gitfile_gently() anymore.
I took a look at the remainder of the series, and except for the "do not call what you know is a singleton 'them'" grammo, everything looked fine to me.
I am tempted to merge them to 'master' before rc2; the alternative is to queue it on ab/i18n-fixup and keep it in 'next' until the 1.7.5 final, and have other people build on top of ab/i18n-fixup topic.