[PATCH 0/7] Gettext poison fixes

STALE3719d

21 messages, 4 authors, 2016-06-15 · open the first message on its own page

[PATCH 0/7] Gettext poison fixes

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:54:32

Not much to say. With this series, the test suite should pass again with
gettext poison on. It's independent with the parseopt-i18n series I
sent yesterday as the test suite was broken even before.

Jiang Xin (7):
  Fix tests under GETTEXT_POISON on relative dates
  Fix tests under GETTEXT_POISON on git-stash
  Fix tests under GETTEXT_POISON on diffstat
  Fix tests under GETTEXT_POISON on git-apply
  Fix tests under GETTEXT_POISON on pack-object
  Fix tests under GETTEXT_POISON on git-remote
  Fix tests under GETTEXT_POISON on parseopt

 t/t0006-date.sh                 |  2 +-
 t/t0040-parse-options.sh        | 34 +++++++++++++++++++++++++++++-----
 t/t1300-repo-config.sh          |  2 +-
 t/t1502-rev-parse-parseopt.sh   |  2 +-
 t/t2006-checkout-index-basic.sh |  4 ++--
 t/t2107-update-index-basic.sh   |  4 ++--
 t/t3004-ls-files-basic.sh       |  4 ++--
 t/t3200-branch.sh               |  4 ++--
 t/t3501-revert-cherry-pick.sh   |  4 ++--
 t/t3903-stash.sh                |  2 +-
 t/t4006-diff-mode.sh            |  8 ++++----
 t/t4012-diff-binary.sh          |  4 ++--
 t/t4120-apply-popt.sh           |  4 ++--
 t/t4133-apply-filenames.sh      |  4 ++--
 t/t4200-rerere.sh               |  4 ++--
 t/t4202-log.sh                  |  2 +-
 t/t4205-log-pretty-formats.sh   |  4 ++--
 t/t5300-pack-object.sh          |  4 ++--
 t/t5505-remote.sh               | 22 ++++++++++++++--------
 t/t5530-upload-pack-error.sh    |  2 +-
 t/t6500-gc.sh                   |  4 ++--
 t/t7508-status.sh               |  2 +-
 t/t7600-merge.sh                |  2 +-
 23 files changed, 79 insertions(+), 49 deletions(-)

-- 
1.7.12.rc2

[PATCH 1/7] Fix tests under GETTEXT_POISON on relative dates

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:54:32

From: Jiang Xin <redacted>

Use a i18n-specific test_i18ncmp in t/t0006-data.sh for relative dates
tests. This issue was was introduced in v1.7.10-230-g7d29a:

    7d29a i18n: mark relative dates for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t0006-date.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index 1d29810..e53cf6d 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -11,7 +11,7 @@ check_show() {
 	echo "$t -> $2" >expect
 	test_expect_${3:-success} "relative date ($2)" "
 	test-date show $t >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 	"
 }
 
-- 
1.7.12.rc2

[PATCH 5/7] Fix tests under GETTEXT_POISON on pack-object

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:54:32

From: Jiang Xin <redacted>

Use i18n-specific test functions in test scripts for pack-object.
This issue was was introduced in v1.7.10.2-556-g46140:

    46140 index-pack: use streaming interface for collision test on large blobs
    cf2ba pack-objects: use streaming interface for reading large loose blobs

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t5300-pack-object.sh       | 4 ++--
 t/t5530-upload-pack-error.sh | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 2e52f8b..a07c871 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -416,11 +416,11 @@ test_expect_success \
 test_expect_success \
     'make sure index-pack detects the SHA1 collision' \
     'test_must_fail git index-pack -o bad.idx test-3.pack 2>msg &&
-     grep "SHA1 COLLISION FOUND" msg'
+     test_i18ngrep "SHA1 COLLISION FOUND" msg'
 
 test_expect_success \
     'make sure index-pack detects the SHA1 collision (large blobs)' \
     'test_must_fail git -c core.bigfilethreshold=1 index-pack -o bad.idx test-3.pack 2>msg &&
-     grep "SHA1 COLLISION FOUND" msg'
+     test_i18ngrep "SHA1 COLLISION FOUND" msg'
 
 test_done
diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh
index 6b2a5f4..99f8dbc 100755
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -35,7 +35,7 @@ test_expect_success 'upload-pack fails due to error in pack-objects packing' '
 	printf "0032want %s\n00000009done\n0000" \
 		$(git rev-parse HEAD) >input &&
 	test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
-	grep "unable to read" output.err &&
+	test_i18ngrep "unable to read" output.err &&
 	grep "pack-objects died" output.err
 '
 
-- 
1.7.12.rc2

[PATCH 3/7] Fix tests under GETTEXT_POISON on diffstat

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:54:32

From: Jiang Xin <redacted>

Use i18n-specific test functions in test scripts for diffstat.
This issue was was introduced in v1.7.9-1-g7f814:

    7f814 Use correct grammar in diffstat summary line

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t4006-diff-mode.sh          | 8 ++++----
 t/t4202-log.sh                | 2 +-
 t/t4205-log-pretty-formats.sh | 4 ++--
 t/t7508-status.sh             | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh
index 7a3e1f9..3d4b1ba 100755
--- a/t/t4006-diff-mode.sh
+++ b/t/t4006-diff-mode.sh
@@ -36,24 +36,24 @@ test_expect_success '--stat output after text chmod' '
 	test_chmod -x rezrov &&
 	echo " 0 files changed" >expect &&
 	git diff HEAD --stat >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 test_expect_success '--shortstat output after text chmod' '
 	git diff HEAD --shortstat >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 test_expect_success '--stat output after binary chmod' '
 	test_chmod +x binbin &&
 	echo " 0 files changed" >expect &&
 	git diff HEAD --stat >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 test_expect_success '--shortstat output after binary chmod' '
 	git diff HEAD --shortstat >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 test_done
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 71be59d..31869dc 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -803,7 +803,7 @@ sanitize_output () {
 test_expect_success 'log --graph with diff and stats' '
 	git log --graph --pretty=short --stat -p >actual &&
 	sanitize_output >actual.sanitized <actual &&
-	test_cmp expect actual.sanitized
+	test_i18ncmp expect actual.sanitized
 '
 
 test_done
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 4afd778..2c45de7 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -88,7 +88,7 @@ test_expect_success 'NUL separation with --stat' '
 	stat1_part=$(git diff --stat --root HEAD^) &&
 	printf "add bar\n$stat0_part\n\0initial\n$stat1_part\n" >expected &&
 	git log -z --stat --pretty="format:%s" >actual &&
-	test_cmp expected actual
+	test_i18ncmp expected actual
 '
 
 test_expect_failure 'NUL termination with --stat' '
@@ -96,7 +96,7 @@ test_expect_failure 'NUL termination with --stat' '
 	stat1_part=$(git diff --stat --root HEAD^) &&
 	printf "add bar\n$stat0_part\n\0initial\n$stat1_part\n\0" >expected &&
 	git log -z --stat --pretty="tformat:%s" >actual &&
-	test_cmp expected actual
+	test_i18ncmp expected actual
 '
 
 test_done
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index c206f47..e313ef1 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -80,7 +80,7 @@ test_expect_success 'status --column' '
 #	dir1/untracked dir2/untracked untracked
 #	dir2/modified  output
 EOF
-	test_cmp expect output
+	test_i18ncmp expect output
 '
 
 cat >expect <<\EOF
-- 
1.7.12.rc2

[PATCH 7/7] Fix tests under GETTEXT_POISON on parseopt

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:54:32

From: Jiang Xin <redacted>

Use i18n-specific test functions in test scripts for parseopt tests.
This issue was was introduced in v1.7.10.1-488-g54e6d:

    54e6d i18n: parseopt: lookup help and argument translations when showing usage

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t0040-parse-options.sh        | 34 +++++++++++++++++++++++++++++-----
 t/t1300-repo-config.sh          |  2 +-
 t/t1502-rev-parse-parseopt.sh   |  2 +-
 t/t2006-checkout-index-basic.sh |  4 ++--
 t/t2107-update-index-basic.sh   |  4 ++--
 t/t3004-ls-files-basic.sh       |  4 ++--
 t/t3200-branch.sh               |  4 ++--
 t/t3501-revert-cherry-pick.sh   |  4 ++--
 t/t4200-rerere.sh               |  4 ++--
 t/t6500-gc.sh                   |  4 ++--
 t/t7600-merge.sh                |  2 +-
 11 files changed, 46 insertions(+), 22 deletions(-)
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index e3f354a..244a43c 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -51,7 +51,7 @@ EOF
 test_expect_success 'test help' '
 	test_must_fail test-parse-options -h > output 2> output.err &&
 	test ! -s output.err &&
-	test_cmp expect output
+	test_i18ncmp expect output
 '
 
 mv expect expect.err
@@ -79,6 +79,17 @@ check() {
 	test_cmp expect output
 }
 
+check_i18n() {
+	what="$1" &&
+	shift &&
+	expect="$1" &&
+	shift &&
+	sed "s/^$what .*/$what $expect/" <expect.template >expect &&
+	test-parse-options $* >output 2>output.err &&
+	test ! -s output.err &&
+	test_i18ncmp expect output
+}
+
 check_unknown() {
 	case "$1" in
 	--*)
@@ -92,6 +103,19 @@ check_unknown() {
 	test_cmp expect output.err
 }
 
+check_unknown_i18n() {
+	case "$1" in
+	--*)
+		echo error: unknown option \`${1#--}\' >expect ;;
+	-*)
+		echo error: unknown switch \`${1#-}\' >expect ;;
+	esac &&
+	cat expect.err >>expect &&
+	test_must_fail test-parse-options $* >output 2>output.err &&
+	test ! -s output &&
+	test_i18ncmp expect output.err
+}
+
 test_expect_success 'OPT_BOOL() #1' 'check boolean: 1 --yes'
 test_expect_success 'OPT_BOOL() #2' 'check boolean: 1 --no-doubt'
 test_expect_success 'OPT_BOOL() #3' 'check boolean: 1 -D'
@@ -104,8 +128,8 @@ test_expect_success 'OPT_BOOL() is idempotent #2' 'check boolean: 1 -DB'
 test_expect_success 'OPT_BOOL() negation #1' 'check boolean: 0 -D --no-yes'
 test_expect_success 'OPT_BOOL() negation #2' 'check boolean: 0 -D --no-no-doubt'
 
-test_expect_success 'OPT_BOOL() no negation #1' 'check_unknown --fear'
-test_expect_success 'OPT_BOOL() no negation #2' 'check_unknown --no-no-fear'
+test_expect_success 'OPT_BOOL() no negation #1' 'check_unknown_i18n --fear'
+test_expect_success 'OPT_BOOL() no negation #2' 'check_unknown_i18n --no-no-fear'
 
 test_expect_success 'OPT_BOOL() positivation' 'check boolean: 0 -D --doubt'
 
@@ -310,8 +334,8 @@ EOF
 
 test_expect_success 'OPT_CALLBACK() and callback errors work' '
 	test_must_fail test-parse-options --no-length > output 2> output.err &&
-	test_cmp expect output &&
-	test_cmp expect.err output.err
+	test_i18ncmp expect output &&
+	test_i18ncmp expect.err output.err
 '
 
 cat > expect <<EOF
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index a477453..e127f35 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -391,7 +391,7 @@ test_expect_success 'get bool variable with empty value' \
 
 test_expect_success 'no arguments, but no crash' '
 	test_must_fail git config >output 2>&1 &&
-	grep usage output
+	test_i18ngrep usage output
 '
 
 cat > .git/config << EOF
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index 1efd7f7..13c88c9 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -41,7 +41,7 @@ EOF
 
 test_expect_success 'test --parseopt help output' '
 	test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec &&
-	test_cmp expect output
+	test_i18ncmp expect output
 '
 
 cat > expect <<EOF
diff --git a/t/t2006-checkout-index-basic.sh b/t/t2006-checkout-index-basic.sh
index b855983..57cbdfe 100755
--- a/t/t2006-checkout-index-basic.sh
+++ b/t/t2006-checkout-index-basic.sh
@@ -7,7 +7,7 @@ test_description='basic checkout-index tests
 
 test_expect_success 'checkout-index --gobbledegook' '
 	test_expect_code 129 git checkout-index --gobbledegook 2>err &&
-	grep "[Uu]sage" err
+	test_i18ngrep "[Uu]sage" err
 '
 
 test_expect_success 'checkout-index -h in broken repository' '
@@ -18,7 +18,7 @@ test_expect_success 'checkout-index -h in broken repository' '
 		>.git/index &&
 		test_expect_code 129 git checkout-index -h >usage 2>&1
 	) &&
-	grep "[Uu]sage" broken/usage
+	test_i18ngrep "[Uu]sage" broken/usage
 '
 
 test_done
diff --git a/t/t2107-update-index-basic.sh b/t/t2107-update-index-basic.sh
index 809fafe..17d6940 100755
--- a/t/t2107-update-index-basic.sh
+++ b/t/t2107-update-index-basic.sh
@@ -15,7 +15,7 @@ test_expect_success 'update-index --nonsense fails' '
 
 test_expect_success 'update-index --nonsense dumps usage' '
 	test_expect_code 129 git update-index --nonsense 2>err &&
-	grep "[Uu]sage: git update-index" err
+	test_i18ngrep "[Uu]sage: git update-index" err
 '
 
 test_expect_success 'update-index -h with corrupt index' '
@@ -26,7 +26,7 @@ test_expect_success 'update-index -h with corrupt index' '
 		>.git/index &&
 		test_expect_code 129 git update-index -h >usage 2>&1
 	) &&
-	grep "[Uu]sage: git update-index" broken/usage
+	test_i18ngrep "[Uu]sage: git update-index" broken/usage
 '
 
 test_done
diff --git a/t/t3004-ls-files-basic.sh b/t/t3004-ls-files-basic.sh
index 490e052..8d9bc3c 100755
--- a/t/t3004-ls-files-basic.sh
+++ b/t/t3004-ls-files-basic.sh
@@ -22,7 +22,7 @@ test_expect_success 'ls-files with nonexistent path' '
 
 test_expect_success 'ls-files with nonsense option' '
 	test_expect_code 129 git ls-files --nonsense 2>actual &&
-	grep "[Uu]sage: git ls-files" actual
+	test_i18ngrep "[Uu]sage: git ls-files" actual
 '
 
 test_expect_success 'ls-files -h in corrupt repository' '
@@ -33,7 +33,7 @@ test_expect_success 'ls-files -h in corrupt repository' '
 		>.git/index &&
 		test_expect_code 129 git ls-files -h >usage 2>&1
 	) &&
-	grep "[Uu]sage: git ls-files " broken/usage
+	test_i18ngrep "[Uu]sage: git ls-files " broken/usage
 '
 
 test_done
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index a17f8b2..1ffce21 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -31,7 +31,7 @@ test_expect_success 'branch -h in broken repository' '
 		>.git/refs/heads/master &&
 		test_expect_code 129 git branch -h >usage 2>&1
 	) &&
-	grep "[Uu]sage" broken/usage
+	test_i18ngrep "[Uu]sage" broken/usage
 '
 
 test_expect_success \
@@ -74,7 +74,7 @@ test_expect_success \
 test_expect_success \
     'git branch -m dumps usage' \
        'test_expect_code 129 git branch -m 2>err &&
-	grep "[Uu]sage: git branch" err'
+	test_i18ngrep "[Uu]sage: git branch" err'
 
 test_expect_success \
     'git branch -m m m/m should work' \
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 595d2ff..34c86e5 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -47,7 +47,7 @@ test_expect_success 'cherry-pick --nonsense' '
 	git diff --exit-code HEAD &&
 	test_must_fail git cherry-pick --nonsense 2>msg &&
 	git diff --exit-code HEAD "$pos" &&
-	grep '[Uu]sage:' msg
+	test_i18ngrep '[Uu]sage:' msg
 '
 
 test_expect_success 'revert --nonsense' '
@@ -56,7 +56,7 @@ test_expect_success 'revert --nonsense' '
 	git diff --exit-code HEAD &&
 	test_must_fail git revert --nonsense 2>msg &&
 	git diff --exit-code HEAD "$pos" &&
-	grep '[Uu]sage:' msg
+	test_i18ngrep '[Uu]sage:' msg
 '
 
 test_expect_success 'cherry-pick after renaming branch' '
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index 3ab670d..7f6666f 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -382,13 +382,13 @@ test_expect_success 'rerere --no-no-rerere-autoupdate' '
 	git update-index --index-info <failedmerge &&
 	cp file3.conflict file3 &&
 	test_must_fail git rerere --no-no-rerere-autoupdate 2>err &&
-	grep [Uu]sage err &&
+	test_i18ngrep [Uu]sage err &&
 	test_must_fail git update-index --refresh
 '
 
 test_expect_success 'rerere -h' '
 	test_must_fail git rerere -h >help &&
-	grep [Uu]sage help
+	test_i18ngrep [Uu]sage help
 '
 
 test_done
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 82f3639..b1a6365 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -11,7 +11,7 @@ test_expect_success 'gc empty repository' '
 
 test_expect_success 'gc --gobbledegook' '
 	test_expect_code 129 git gc --nonsense 2>err &&
-	grep "[Uu]sage: git gc" err
+	test_i18ngrep "[Uu]sage: git gc" err
 '
 
 test_expect_success 'gc -h with invalid configuration' '
@@ -22,7 +22,7 @@ test_expect_success 'gc -h with invalid configuration' '
 		echo "[gc] pruneexpire = CORRUPT" >>.git/config &&
 		test_expect_code 129 git gc -h >usage 2>&1
 	) &&
-	grep "[Uu]sage" broken/usage
+	test_i18ngrep "[Uu]sage" broken/usage
 '
 
 test_done
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 9e27bbf..5e19598 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -157,7 +157,7 @@ test_expect_success 'merge -h with invalid index' '
 		>.git/index &&
 		test_expect_code 129 git merge -h 2>usage
 	) &&
-	grep "[Uu]sage: git merge" broken/usage
+	test_i18ngrep "[Uu]sage: git merge" broken/usage
 '
 
 test_expect_success 'reject non-strategy with a git-merge-foo name' '
-- 
1.7.12.rc2

[PATCH 2/7] Fix tests under GETTEXT_POISON on git-stash

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:54:32

From: Jiang Xin <redacted>

Use i18n-specific test functions in test scripts for git-stash.
This issue was was introduced in v1.7.4.1-119-g355ec:

    355ec i18n: git-status basic messages

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t3903-stash.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index cd04263..5dfbda7 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -610,7 +610,7 @@ test_expect_success 'stash apply shows status same as git status (relative to cu
 		git stash apply
 	) |
 	sed -e 1,2d >actual && # drop "Saved..." and "HEAD is now..."
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 cat > expect << EOF
-- 
1.7.12.rc2

[PATCH 6/7] Fix tests under GETTEXT_POISON on git-remote

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:54:32

From: Jiang Xin <redacted>

Use i18n-specific test functions in test scripts for git-remote.
This issue was was introduced in v1.7.10-233-gbb16d5:

    bb16d5 i18n: remote: mark strings for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t5505-remote.sh | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index e8af615..07045e3 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -27,10 +27,16 @@ tokens_match () {
 	test_cmp expect actual
 }
 
+tokens_i18nmatch () {
+	echo "$1" | tr ' ' '\012' | sort | sed -e '/^$/d' >expect &&
+	echo "$2" | tr ' ' '\012' | sort | sed -e '/^$/d' >actual &&
+	test_i18ncmp expect actual
+}
+
 check_remote_track () {
 	actual=$(git remote show "$1" | sed -ne 's|^    \(.*\) tracked$|\1|p')
 	shift &&
-	tokens_match "$*" "$actual"
+	tokens_i18nmatch "$*" "$actual"
 }
 
 check_tracking_branch () {
@@ -131,8 +137,8 @@ EOF
 	git remote rm oops 2>actual2 &&
 	git branch -d foobranch &&
 	git tag -d footag &&
-	test_cmp expect1 actual1 &&
-	test_cmp expect2 actual2
+	test_i18ncmp expect1 actual1 &&
+	test_i18ncmp expect2 actual2
 )
 '
 
@@ -192,7 +198,7 @@ test_expect_success 'show' '
 	 git config --add remote.two.push refs/heads/master:refs/heads/another &&
 	 git remote show origin two > output &&
 	 git branch -d rebase octopus &&
-	 test_cmp expect output)
+	 test_i18ncmp expect output)
 '
 
 cat > test/expect << EOF
@@ -217,7 +223,7 @@ test_expect_success 'show -n' '
 	 cd test &&
 	 git remote show -n origin > output &&
 	 mv ../one.unreachable ../one &&
-	 test_cmp expect output)
+	 test_i18ncmp expect output)
 '
 
 test_expect_success 'prune' '
@@ -255,7 +261,7 @@ EOF
 test_expect_success 'set-head --auto fails w/multiple HEADs' '
 	(cd test &&
 	 test_must_fail git remote set-head --auto two >output 2>&1 &&
-	test_cmp expect output)
+	test_i18ncmp expect output)
 '
 
 cat >test/expect <<EOF
@@ -285,7 +291,7 @@ test_expect_success 'prune --dry-run' '
 	 test_must_fail git rev-parse refs/remotes/origin/side &&
 	(cd ../one &&
 	 git branch -m side side2) &&
-	 test_cmp expect output)
+	 test_i18ncmp expect output)
 '
 
 test_expect_success 'add --mirror && prune' '
@@ -705,7 +711,7 @@ test_expect_success 'remote prune to cause a dangling symref' '
 		cd seven &&
 		git remote prune origin
 	) >err 2>&1 &&
-	grep "has become dangling" err &&
+	test_i18ngrep "has become dangling" err &&
 
 	: And the dangling symref will not cause other annoying errors &&
 	(
-- 
1.7.12.rc2

[PATCH 4/7] Fix tests under GETTEXT_POISON on git-apply

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:54:32

From: Jiang Xin <redacted>

Use i18n-specific test functions in test scripts for git-apply.
This issue was was introduced in the following commits:

    de373 i18n: apply: mark parseopt strings for translation
    3638e i18n: apply: mark strings for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t4012-diff-binary.sh     | 4 ++--
 t/t4120-apply-popt.sh      | 4 ++--
 t/t4133-apply-filenames.sh | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh
index ec4deea..1215ae5 100755
--- a/t/t4012-diff-binary.sh
+++ b/t/t4012-diff-binary.sh
@@ -63,7 +63,7 @@ test_expect_success 'apply --numstat understands diff --binary format' '
 
 # apply needs to be able to skip the binary material correctly
 # in order to report the line number of a corrupt patch.
-test_expect_success 'apply detecting corrupt patch correctly' '
+test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
 	git diff >output &&
 	sed -e "s/-CIT/xCIT/" <output >broken &&
 	test_must_fail git apply --stat --summary broken 2>detected &&
@@ -73,7 +73,7 @@ test_expect_success 'apply detecting corrupt patch correctly' '
 	test "$detected" = xCIT
 '
 
-test_expect_success 'apply detecting corrupt patch correctly' '
+test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
 	git diff --binary | sed -e "s/-CIT/xCIT/" >broken &&
 	test_must_fail git apply --stat --summary broken 2>detected &&
 	detected=`cat detected` &&
diff --git a/t/t4120-apply-popt.sh b/t/t4120-apply-popt.sh
index a33d510..c5fecdf 100755
--- a/t/t4120-apply-popt.sh
+++ b/t/t4120-apply-popt.sh
@@ -32,7 +32,7 @@ test_expect_success 'apply git diff with -p2' '
 test_expect_success 'apply with too large -p' '
 	cp file1.saved file1 &&
 	test_must_fail git apply --stat -p3 patch.file 2>err &&
-	grep "removing 3 leading" err
+	test_i18ngrep "removing 3 leading" err
 '
 
 test_expect_success 'apply (-p2) traditional diff with funny filenames' '
@@ -54,7 +54,7 @@ test_expect_success 'apply (-p2) traditional diff with funny filenames' '
 test_expect_success 'apply with too large -p and fancy filename' '
 	cp file1.saved file1 &&
 	test_must_fail git apply --stat -p3 patch.escaped 2>err &&
-	grep "removing 3 leading" err
+	test_i18ngrep "removing 3 leading" err
 '
 
 test_expect_success 'apply (-p2) diff, mode change only' '
diff --git a/t/t4133-apply-filenames.sh b/t/t4133-apply-filenames.sh
index 94da990..2ecb421 100755
--- a/t/t4133-apply-filenames.sh
+++ b/t/t4133-apply-filenames.sh
@@ -30,9 +30,9 @@ EOF
 
 test_expect_success 'apply diff with inconsistent filenames in headers' '
 	test_must_fail git apply bad1.patch 2>err &&
-	grep "inconsistent new filename" err &&
+	test_i18ngrep "inconsistent new filename" err &&
 	test_must_fail git apply bad2.patch 2>err &&
-	grep "inconsistent old filename" err
+	test_i18ngrep "inconsistent old filename" err
 '
 
 test_done
-- 
1.7.12.rc2

Re: [PATCH 5/7] Fix tests under GETTEXT_POISON on pack-object

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:54:32

Hi,

Nguyễn Thái Ngọc Duy wrote:
From: Jiang Xin <redacted>

Use i18n-specific test functions in test scripts for pack-object.
Thanks for resending, and sorry I haven't made time to polish the
translation-based poison implementation you sent before (which seemed
very useful and pleasant to work with).

[...]
quoted hunk
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -35,7 +35,7 @@ test_expect_success 'upload-pack fails due to error in pack-objects packing' '
 	printf "0032want %s\n00000009done\n0000" \
 		$(git rev-parse HEAD) >input &&
 	test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
-	grep "unable to read" output.err &&
+	test_i18ngrep "unable to read" output.err &&
 	grep "pack-objects died" output.err
Wouldn't it make sense to change the second "grep" of output intended
for humans to test_i18ngrep while at it?

With or without that change, this and the rest of the series looks
good.

Hope that helps,
Jonathan

Re: [PATCH 5/7] Fix tests under GETTEXT_POISON on pack-object

From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:54:32

On Tue, Aug 21, 2012 at 12:17 PM, Jonathan Nieder [off-list ref] wrote:
quoted
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -35,7 +35,7 @@ test_expect_success 'upload-pack fails due to error in pack-objects packing' '
      printf "0032want %s\n00000009done\n0000" \
              $(git rev-parse HEAD) >input &&
      test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
-     grep "unable to read" output.err &&
+     test_i18ngrep "unable to read" output.err &&
      grep "pack-objects died" output.err
Wouldn't it make sense to change the second "grep" of output intended
for humans to test_i18ngrep while at it?
This comes from error("git upload-pack: git-pack-objects died with
error.") in unpack-trees.c, which is not i18n-ized yet. There's
another test in t5530 that does the same grep. I think we should leave
it as is until we mark the string for translation, then gettext poison
will spot it (verified) and we can fix it.
-- 
Duy

Re: [PATCH 5/7] Fix tests under GETTEXT_POISON on pack-object

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:54:32

Nguyen Thai Ngoc Duy wrote:
On Tue, Aug 21, 2012 at 12:17 PM, Jonathan Nieder [off-list ref] wrote:
quoted
quoted
@@ -35,7 +35,7 @@ test_expect_success 'upload-pack fails due to error in pack-objects packing' '
      printf "0032want %s\n00000009done\n0000" \
              $(git rev-parse HEAD) >input &&
      test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
-     grep "unable to read" output.err &&
+     test_i18ngrep "unable to read" output.err &&
      grep "pack-objects died" output.err
Wouldn't it make sense to change the second "grep" of output intended
for humans to test_i18ngrep while at it?
This comes from error("git upload-pack: git-pack-objects died with
error.") in unpack-trees.c, which is not i18n-ized yet. There's
another test in t5530 that does the same grep. I think we should leave
it as is until we mark the string for translation, then gettext poison
will spot it (verified) and we can fix it.
I don't understand the distinction you're making.  Isn't the message
intended for humans, and wouldn't changing that one line to
test_i18ngrep now save trouble later?  Tests are meant to check git's
intended behavior, not to exactly match its current behavior.

Jonathan

[PATCH v2 0/7] Gettext poison fixes

From: Jiang Xin <hidden>
Date: 2016-06-15 22:54:35

Update patch 5/7 (Fix tests under GETTEXT_POISON on pack-object)
and patch 6/7 (Fix tests under GETTEXT_POISON on git-remote) in
this new series of patches.

Not much to say. With this series, the test suite should pass again with
gettext poison on. It's independent with the parseopt-i18n series I
sent yesterday as the test suite was broken even before.

Jiang Xin (7):
  Fix tests under GETTEXT_POISON on relative dates
  Fix tests under GETTEXT_POISON on git-stash
  Fix tests under GETTEXT_POISON on diffstat
  Fix tests under GETTEXT_POISON on git-apply
  Fix tests under GETTEXT_POISON on pack-object
  Fix tests under GETTEXT_POISON on git-remote
  Fix tests under GETTEXT_POISON on parseopt

 t/t0006-date.sh                 |  2 +-
 t/t0040-parse-options.sh        | 34 +++++++++++++++++++++++++++++-----
 t/t1300-repo-config.sh          |  2 +-
 t/t1502-rev-parse-parseopt.sh   |  2 +-
 t/t2006-checkout-index-basic.sh |  4 ++--
 t/t2107-update-index-basic.sh   |  4 ++--
 t/t3004-ls-files-basic.sh       |  4 ++--
 t/t3200-branch.sh               |  4 ++--
 t/t3501-revert-cherry-pick.sh   |  4 ++--
 t/t3903-stash.sh                |  2 +-
 t/t4006-diff-mode.sh            |  8 ++++----
 t/t4012-diff-binary.sh          |  4 ++--
 t/t4120-apply-popt.sh           |  4 ++--
 t/t4133-apply-filenames.sh      |  4 ++--
 t/t4200-rerere.sh               |  4 ++--
 t/t4202-log.sh                  |  2 +-
 t/t4205-log-pretty-formats.sh   |  4 ++--
 t/t5300-pack-object.sh          |  4 ++--
 t/t5505-remote.sh               | 28 +++++++++++++++++-----------
 t/t5530-upload-pack-error.sh    |  4 ++--
 t/t6500-gc.sh                   |  4 ++--
 t/t7508-status.sh               |  2 +-
 t/t7600-merge.sh                |  2 +-
 23 files changed, 83 insertions(+), 53 deletions(-)

-- 
1.7.12.92.gaa91cb5

[PATCH v2 1/7] Fix tests under GETTEXT_POISON on relative dates

From: Jiang Xin <hidden>
Date: 2016-06-15 22:54:35

Use a i18n-specific test_i18ncmp in t/t0006-data.sh for relative dates
tests. This issue was was introduced in v1.7.10-230-g7d29a:

    7d29a i18n: mark relative dates for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t0006-date.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index 1d29..e53cf 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -11,7 +11,7 @@ check_show() {
 	echo "$t -> $2" >expect
 	test_expect_${3:-success} "relative date ($2)" "
 	test-date show $t >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 	"
 }
 
-- 
1.7.12.92.gaa91cb5

[PATCH v2 2/7] Fix tests under GETTEXT_POISON on git-stash

From: Jiang Xin <hidden>
Date: 2016-06-15 22:54:35

Use i18n-specific test functions in test scripts for git-stash.
This issue was was introduced in v1.7.4.1-119-g355ec:

    355ec i18n: git-status basic messages

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t3903-stash.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index cd0426..5dfbd 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -610,7 +610,7 @@ test_expect_success 'stash apply shows status same as git status (relative to cu
 		git stash apply
 	) |
 	sed -e 1,2d >actual && # drop "Saved..." and "HEAD is now..."
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 cat > expect << EOF
-- 
1.7.12.92.gaa91cb5

[PATCH v2 3/7] Fix tests under GETTEXT_POISON on diffstat

From: Jiang Xin <hidden>
Date: 2016-06-15 22:54:35

Use i18n-specific test functions in test scripts for diffstat.
This issue was was introduced in v1.7.9-1-g7f814:

    7f814 Use correct grammar in diffstat summary line

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t4006-diff-mode.sh          | 8 ++++----
 t/t4202-log.sh                | 2 +-
 t/t4205-log-pretty-formats.sh | 4 ++--
 t/t7508-status.sh             | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh
index 7a3e1..3d4b1 100755
--- a/t/t4006-diff-mode.sh
+++ b/t/t4006-diff-mode.sh
@@ -36,24 +36,24 @@ test_expect_success '--stat output after text chmod' '
 	test_chmod -x rezrov &&
 	echo " 0 files changed" >expect &&
 	git diff HEAD --stat >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 test_expect_success '--shortstat output after text chmod' '
 	git diff HEAD --shortstat >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 test_expect_success '--stat output after binary chmod' '
 	test_chmod +x binbin &&
 	echo " 0 files changed" >expect &&
 	git diff HEAD --stat >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 test_expect_success '--shortstat output after binary chmod' '
 	git diff HEAD --shortstat >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 test_done
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 71be5..31869 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -803,7 +803,7 @@ sanitize_output () {
 test_expect_success 'log --graph with diff and stats' '
 	git log --graph --pretty=short --stat -p >actual &&
 	sanitize_output >actual.sanitized <actual &&
-	test_cmp expect actual.sanitized
+	test_i18ncmp expect actual.sanitized
 '
 
 test_done
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 4afd77..2c45d 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -88,7 +88,7 @@ test_expect_success 'NUL separation with --stat' '
 	stat1_part=$(git diff --stat --root HEAD^) &&
 	printf "add bar\n$stat0_part\n\0initial\n$stat1_part\n" >expected &&
 	git log -z --stat --pretty="format:%s" >actual &&
-	test_cmp expected actual
+	test_i18ncmp expected actual
 '
 
 test_expect_failure 'NUL termination with --stat' '
@@ -96,7 +96,7 @@ test_expect_failure 'NUL termination with --stat' '
 	stat1_part=$(git diff --stat --root HEAD^) &&
 	printf "add bar\n$stat0_part\n\0initial\n$stat1_part\n\0" >expected &&
 	git log -z --stat --pretty="tformat:%s" >actual &&
-	test_cmp expected actual
+	test_i18ncmp expected actual
 '
 
 test_done
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index c206f..e313e 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -80,7 +80,7 @@ test_expect_success 'status --column' '
 #	dir1/untracked dir2/untracked untracked
 #	dir2/modified  output
 EOF
-	test_cmp expect output
+	test_i18ncmp expect output
 '
 
 cat >expect <<\EOF
-- 
1.7.12.92.gaa91cb5

[PATCH v2 4/7] Fix tests under GETTEXT_POISON on git-apply

From: Jiang Xin <hidden>
Date: 2016-06-15 22:54:35

Use i18n-specific test functions in test scripts for git-apply.
This issue was was introduced in the following commits:

    de373 i18n: apply: mark parseopt strings for translation
    3638e i18n: apply: mark strings for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t4012-diff-binary.sh     | 4 ++--
 t/t4120-apply-popt.sh      | 4 ++--
 t/t4133-apply-filenames.sh | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh
index ec4de..1215a 100755
--- a/t/t4012-diff-binary.sh
+++ b/t/t4012-diff-binary.sh
@@ -63,7 +63,7 @@ test_expect_success 'apply --numstat understands diff --binary format' '
 
 # apply needs to be able to skip the binary material correctly
 # in order to report the line number of a corrupt patch.
-test_expect_success 'apply detecting corrupt patch correctly' '
+test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
 	git diff >output &&
 	sed -e "s/-CIT/xCIT/" <output >broken &&
 	test_must_fail git apply --stat --summary broken 2>detected &&
@@ -73,7 +73,7 @@ test_expect_success 'apply detecting corrupt patch correctly' '
 	test "$detected" = xCIT
 '
 
-test_expect_success 'apply detecting corrupt patch correctly' '
+test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
 	git diff --binary | sed -e "s/-CIT/xCIT/" >broken &&
 	test_must_fail git apply --stat --summary broken 2>detected &&
 	detected=`cat detected` &&
diff --git a/t/t4120-apply-popt.sh b/t/t4120-apply-popt.sh
index a33d5..c5fec 100755
--- a/t/t4120-apply-popt.sh
+++ b/t/t4120-apply-popt.sh
@@ -32,7 +32,7 @@ test_expect_success 'apply git diff with -p2' '
 test_expect_success 'apply with too large -p' '
 	cp file1.saved file1 &&
 	test_must_fail git apply --stat -p3 patch.file 2>err &&
-	grep "removing 3 leading" err
+	test_i18ngrep "removing 3 leading" err
 '
 
 test_expect_success 'apply (-p2) traditional diff with funny filenames' '
@@ -54,7 +54,7 @@ test_expect_success 'apply (-p2) traditional diff with funny filenames' '
 test_expect_success 'apply with too large -p and fancy filename' '
 	cp file1.saved file1 &&
 	test_must_fail git apply --stat -p3 patch.escaped 2>err &&
-	grep "removing 3 leading" err
+	test_i18ngrep "removing 3 leading" err
 '
 
 test_expect_success 'apply (-p2) diff, mode change only' '
diff --git a/t/t4133-apply-filenames.sh b/t/t4133-apply-filenames.sh
index 94da9..2ecb4 100755
--- a/t/t4133-apply-filenames.sh
+++ b/t/t4133-apply-filenames.sh
@@ -30,9 +30,9 @@ EOF
 
 test_expect_success 'apply diff with inconsistent filenames in headers' '
 	test_must_fail git apply bad1.patch 2>err &&
-	grep "inconsistent new filename" err &&
+	test_i18ngrep "inconsistent new filename" err &&
 	test_must_fail git apply bad2.patch 2>err &&
-	grep "inconsistent old filename" err
+	test_i18ngrep "inconsistent old filename" err
 '
 
 test_done
-- 
1.7.12.92.gaa91cb5

[PATCH v2 6/7] Fix tests under GETTEXT_POISON on git-remote

From: Jiang Xin <hidden>
Date: 2016-06-15 22:54:35

Use i18n-specific test functions in test scripts for git-remote.
This issue was was introduced in v1.7.10-233-gbb16d5:

    bb16d5 i18n: remote: mark strings for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t5505-remote.sh | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index e8af6..7f0cb 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -52,7 +52,7 @@ test_expect_success setup '
 
 '
 
-test_expect_success 'remote information for the origin' '
+test_expect_success C_LOCALE_OUTPUT 'remote information for the origin' '
 (
 	cd test &&
 	tokens_match origin "$(git remote)" &&
@@ -66,8 +66,6 @@ test_expect_success 'add another remote' '
 	cd test &&
 	git remote add -f second ../two &&
 	tokens_match "origin second" "$(git remote)" &&
-	check_remote_track origin master side &&
-	check_remote_track second master side another &&
 	check_tracking_branch second master side another &&
 	git for-each-ref "--format=%(refname)" refs/remotes |
 	sed -e "/^refs\/remotes\/origin\//d" \
@@ -77,6 +75,14 @@ test_expect_success 'add another remote' '
 )
 '
 
+test_expect_success C_LOCALE_OUTPUT 'add another remote' '
+(
+	cd test &&
+	check_remote_track origin master side &&
+	check_remote_track second master side another &&
+)
+'
+
 test_expect_success 'remote forces tracking branches' '
 (
 	cd test &&
@@ -95,7 +101,7 @@ test_expect_success 'remove remote' '
 )
 '
 
-test_expect_success 'remove remote' '
+test_expect_success C_LOCALE_OUTPUT 'remove remote' '
 (
 	cd test &&
 	tokens_match origin "$(git remote)" &&
@@ -131,8 +137,8 @@ EOF
 	git remote rm oops 2>actual2 &&
 	git branch -d foobranch &&
 	git tag -d footag &&
-	test_cmp expect1 actual1 &&
-	test_cmp expect2 actual2
+	test_i18ncmp expect1 actual1 &&
+	test_i18ncmp expect2 actual2
 )
 '
 
@@ -192,7 +198,7 @@ test_expect_success 'show' '
 	 git config --add remote.two.push refs/heads/master:refs/heads/another &&
 	 git remote show origin two > output &&
 	 git branch -d rebase octopus &&
-	 test_cmp expect output)
+	 test_i18ncmp expect output)
 '
 
 cat > test/expect << EOF
@@ -217,7 +223,7 @@ test_expect_success 'show -n' '
 	 cd test &&
 	 git remote show -n origin > output &&
 	 mv ../one.unreachable ../one &&
-	 test_cmp expect output)
+	 test_i18ncmp expect output)
 '
 
 test_expect_success 'prune' '
@@ -255,7 +261,7 @@ EOF
 test_expect_success 'set-head --auto fails w/multiple HEADs' '
 	(cd test &&
 	 test_must_fail git remote set-head --auto two >output 2>&1 &&
-	test_cmp expect output)
+	test_i18ncmp expect output)
 '
 
 cat >test/expect <<EOF
@@ -285,7 +291,7 @@ test_expect_success 'prune --dry-run' '
 	 test_must_fail git rev-parse refs/remotes/origin/side &&
 	(cd ../one &&
 	 git branch -m side side2) &&
-	 test_cmp expect output)
+	 test_i18ncmp expect output)
 '
 
 test_expect_success 'add --mirror && prune' '
@@ -705,7 +711,7 @@ test_expect_success 'remote prune to cause a dangling symref' '
 		cd seven &&
 		git remote prune origin
 	) >err 2>&1 &&
-	grep "has become dangling" err &&
+	test_i18ngrep "has become dangling" err &&
 
 	: And the dangling symref will not cause other annoying errors &&
 	(
-- 
1.7.12.92.gaa91cb5

[PATCH v2 5/7] Fix tests under GETTEXT_POISON on pack-object

From: Jiang Xin <hidden>
Date: 2016-06-15 22:54:35

Use i18n-specific test functions in test scripts for pack-object.
This issue was was introduced in v1.7.10.2-556-g46140:

    46140 index-pack: use streaming interface for collision test on large blobs
    cf2ba pack-objects: use streaming interface for reading large loose blobs

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t5300-pack-object.sh       | 4 ++--
 t/t5530-upload-pack-error.sh | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 2e52..a07c8 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -416,11 +416,11 @@ test_expect_success \
 test_expect_success \
     'make sure index-pack detects the SHA1 collision' \
     'test_must_fail git index-pack -o bad.idx test-3.pack 2>msg &&
-     grep "SHA1 COLLISION FOUND" msg'
+     test_i18ngrep "SHA1 COLLISION FOUND" msg'
 
 test_expect_success \
     'make sure index-pack detects the SHA1 collision (large blobs)' \
     'test_must_fail git -c core.bigfilethreshold=1 index-pack -o bad.idx test-3.pack 2>msg &&
-     grep "SHA1 COLLISION FOUND" msg'
+     test_i18ngrep "SHA1 COLLISION FOUND" msg'
 
 test_done
diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh
index 6b2a5f..c983d 100755
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -35,8 +35,8 @@ test_expect_success 'upload-pack fails due to error in pack-objects packing' '
 	printf "0032want %s\n00000009done\n0000" \
 		$(git rev-parse HEAD) >input &&
 	test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
-	grep "unable to read" output.err &&
-	grep "pack-objects died" output.err
+	test_i18ngrep "unable to read" output.err &&
+	test_i18ngrep "pack-objects died" output.err
 '
 
 test_expect_success 'corrupt repo differently' '
-- 
1.7.12.92.gaa91cb5

[PATCH v2 7/7] Fix tests under GETTEXT_POISON on parseopt

From: Jiang Xin <hidden>
Date: 2016-06-15 22:54:35

Use i18n-specific test functions in test scripts for parseopt tests.
This issue was was introduced in v1.7.10.1-488-g54e6d:

    54e6d i18n: parseopt: lookup help and argument translations when showing usage

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t0040-parse-options.sh        | 34 +++++++++++++++++++++++++++++-----
 t/t1300-repo-config.sh          |  2 +-
 t/t1502-rev-parse-parseopt.sh   |  2 +-
 t/t2006-checkout-index-basic.sh |  4 ++--
 t/t2107-update-index-basic.sh   |  4 ++--
 t/t3004-ls-files-basic.sh       |  4 ++--
 t/t3200-branch.sh               |  4 ++--
 t/t3501-revert-cherry-pick.sh   |  4 ++--
 t/t4200-rerere.sh               |  4 ++--
 t/t6500-gc.sh                   |  4 ++--
 t/t7600-merge.sh                |  2 +-
 11 files changed, 46 insertions(+), 22 deletions(-)
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index e3f35..244a4 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -51,7 +51,7 @@ EOF
 test_expect_success 'test help' '
 	test_must_fail test-parse-options -h > output 2> output.err &&
 	test ! -s output.err &&
-	test_cmp expect output
+	test_i18ncmp expect output
 '
 
 mv expect expect.err
@@ -79,6 +79,17 @@ check() {
 	test_cmp expect output
 }
 
+check_i18n() {
+	what="$1" &&
+	shift &&
+	expect="$1" &&
+	shift &&
+	sed "s/^$what .*/$what $expect/" <expect.template >expect &&
+	test-parse-options $* >output 2>output.err &&
+	test ! -s output.err &&
+	test_i18ncmp expect output
+}
+
 check_unknown() {
 	case "$1" in
 	--*)
@@ -92,6 +103,19 @@ check_unknown() {
 	test_cmp expect output.err
 }
 
+check_unknown_i18n() {
+	case "$1" in
+	--*)
+		echo error: unknown option \`${1#--}\' >expect ;;
+	-*)
+		echo error: unknown switch \`${1#-}\' >expect ;;
+	esac &&
+	cat expect.err >>expect &&
+	test_must_fail test-parse-options $* >output 2>output.err &&
+	test ! -s output &&
+	test_i18ncmp expect output.err
+}
+
 test_expect_success 'OPT_BOOL() #1' 'check boolean: 1 --yes'
 test_expect_success 'OPT_BOOL() #2' 'check boolean: 1 --no-doubt'
 test_expect_success 'OPT_BOOL() #3' 'check boolean: 1 -D'
@@ -104,8 +128,8 @@ test_expect_success 'OPT_BOOL() is idempotent #2' 'check boolean: 1 -DB'
 test_expect_success 'OPT_BOOL() negation #1' 'check boolean: 0 -D --no-yes'
 test_expect_success 'OPT_BOOL() negation #2' 'check boolean: 0 -D --no-no-doubt'
 
-test_expect_success 'OPT_BOOL() no negation #1' 'check_unknown --fear'
-test_expect_success 'OPT_BOOL() no negation #2' 'check_unknown --no-no-fear'
+test_expect_success 'OPT_BOOL() no negation #1' 'check_unknown_i18n --fear'
+test_expect_success 'OPT_BOOL() no negation #2' 'check_unknown_i18n --no-no-fear'
 
 test_expect_success 'OPT_BOOL() positivation' 'check boolean: 0 -D --doubt'
 
@@ -310,8 +334,8 @@ EOF
 
 test_expect_success 'OPT_CALLBACK() and callback errors work' '
 	test_must_fail test-parse-options --no-length > output 2> output.err &&
-	test_cmp expect output &&
-	test_cmp expect.err output.err
+	test_i18ncmp expect output &&
+	test_i18ncmp expect.err output.err
 '
 
 cat > expect <<EOF
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index a477..e127f 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -391,7 +391,7 @@ test_expect_success 'get bool variable with empty value' \
 
 test_expect_success 'no arguments, but no crash' '
 	test_must_fail git config >output 2>&1 &&
-	grep usage output
+	test_i18ngrep usage output
 '
 
 cat > .git/config << EOF
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index 1efd7..13c88 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -41,7 +41,7 @@ EOF
 
 test_expect_success 'test --parseopt help output' '
 	test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec &&
-	test_cmp expect output
+	test_i18ncmp expect output
 '
 
 cat > expect <<EOF
diff --git a/t/t2006-checkout-index-basic.sh b/t/t2006-checkout-index-basic.sh
index b855..57cbd 100755
--- a/t/t2006-checkout-index-basic.sh
+++ b/t/t2006-checkout-index-basic.sh
@@ -7,7 +7,7 @@ test_description='basic checkout-index tests
 
 test_expect_success 'checkout-index --gobbledegook' '
 	test_expect_code 129 git checkout-index --gobbledegook 2>err &&
-	grep "[Uu]sage" err
+	test_i18ngrep "[Uu]sage" err
 '
 
 test_expect_success 'checkout-index -h in broken repository' '
@@ -18,7 +18,7 @@ test_expect_success 'checkout-index -h in broken repository' '
 		>.git/index &&
 		test_expect_code 129 git checkout-index -h >usage 2>&1
 	) &&
-	grep "[Uu]sage" broken/usage
+	test_i18ngrep "[Uu]sage" broken/usage
 '
 
 test_done
diff --git a/t/t2107-update-index-basic.sh b/t/t2107-update-index-basic.sh
index 809fa..17d69 100755
--- a/t/t2107-update-index-basic.sh
+++ b/t/t2107-update-index-basic.sh
@@ -15,7 +15,7 @@ test_expect_success 'update-index --nonsense fails' '
 
 test_expect_success 'update-index --nonsense dumps usage' '
 	test_expect_code 129 git update-index --nonsense 2>err &&
-	grep "[Uu]sage: git update-index" err
+	test_i18ngrep "[Uu]sage: git update-index" err
 '
 
 test_expect_success 'update-index -h with corrupt index' '
@@ -26,7 +26,7 @@ test_expect_success 'update-index -h with corrupt index' '
 		>.git/index &&
 		test_expect_code 129 git update-index -h >usage 2>&1
 	) &&
-	grep "[Uu]sage: git update-index" broken/usage
+	test_i18ngrep "[Uu]sage: git update-index" broken/usage
 '
 
 test_done
diff --git a/t/t3004-ls-files-basic.sh b/t/t3004-ls-files-basic.sh
index 490e05..8d9bc 100755
--- a/t/t3004-ls-files-basic.sh
+++ b/t/t3004-ls-files-basic.sh
@@ -22,7 +22,7 @@ test_expect_success 'ls-files with nonexistent path' '
 
 test_expect_success 'ls-files with nonsense option' '
 	test_expect_code 129 git ls-files --nonsense 2>actual &&
-	grep "[Uu]sage: git ls-files" actual
+	test_i18ngrep "[Uu]sage: git ls-files" actual
 '
 
 test_expect_success 'ls-files -h in corrupt repository' '
@@ -33,7 +33,7 @@ test_expect_success 'ls-files -h in corrupt repository' '
 		>.git/index &&
 		test_expect_code 129 git ls-files -h >usage 2>&1
 	) &&
-	grep "[Uu]sage: git ls-files " broken/usage
+	test_i18ngrep "[Uu]sage: git ls-files " broken/usage
 '
 
 test_done
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index a17f8..1ffce 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -31,7 +31,7 @@ test_expect_success 'branch -h in broken repository' '
 		>.git/refs/heads/master &&
 		test_expect_code 129 git branch -h >usage 2>&1
 	) &&
-	grep "[Uu]sage" broken/usage
+	test_i18ngrep "[Uu]sage" broken/usage
 '
 
 test_expect_success \
@@ -74,7 +74,7 @@ test_expect_success \
 test_expect_success \
     'git branch -m dumps usage' \
        'test_expect_code 129 git branch -m 2>err &&
-	grep "[Uu]sage: git branch" err'
+	test_i18ngrep "[Uu]sage: git branch" err'
 
 test_expect_success \
     'git branch -m m m/m should work' \
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 595d2..34c86e 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -47,7 +47,7 @@ test_expect_success 'cherry-pick --nonsense' '
 	git diff --exit-code HEAD &&
 	test_must_fail git cherry-pick --nonsense 2>msg &&
 	git diff --exit-code HEAD "$pos" &&
-	grep '[Uu]sage:' msg
+	test_i18ngrep '[Uu]sage:' msg
 '
 
 test_expect_success 'revert --nonsense' '
@@ -56,7 +56,7 @@ test_expect_success 'revert --nonsense' '
 	git diff --exit-code HEAD &&
 	test_must_fail git revert --nonsense 2>msg &&
 	git diff --exit-code HEAD "$pos" &&
-	grep '[Uu]sage:' msg
+	test_i18ngrep '[Uu]sage:' msg
 '
 
 test_expect_success 'cherry-pick after renaming branch' '
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index 3ab67..7f666 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -382,13 +382,13 @@ test_expect_success 'rerere --no-no-rerere-autoupdate' '
 	git update-index --index-info <failedmerge &&
 	cp file3.conflict file3 &&
 	test_must_fail git rerere --no-no-rerere-autoupdate 2>err &&
-	grep [Uu]sage err &&
+	test_i18ngrep [Uu]sage err &&
 	test_must_fail git update-index --refresh
 '
 
 test_expect_success 'rerere -h' '
 	test_must_fail git rerere -h >help &&
-	grep [Uu]sage help
+	test_i18ngrep [Uu]sage help
 '
 
 test_done
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 82f36..b1a63 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -11,7 +11,7 @@ test_expect_success 'gc empty repository' '
 
 test_expect_success 'gc --gobbledegook' '
 	test_expect_code 129 git gc --nonsense 2>err &&
-	grep "[Uu]sage: git gc" err
+	test_i18ngrep "[Uu]sage: git gc" err
 '
 
 test_expect_success 'gc -h with invalid configuration' '
@@ -22,7 +22,7 @@ test_expect_success 'gc -h with invalid configuration' '
 		echo "[gc] pruneexpire = CORRUPT" >>.git/config &&
 		test_expect_code 129 git gc -h >usage 2>&1
 	) &&
-	grep "[Uu]sage" broken/usage
+	test_i18ngrep "[Uu]sage" broken/usage
 '
 
 test_done
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 9e27b..5e195 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -157,7 +157,7 @@ test_expect_success 'merge -h with invalid index' '
 		>.git/index &&
 		test_expect_code 129 git merge -h 2>usage
 	) &&
-	grep "[Uu]sage: git merge" broken/usage
+	test_i18ngrep "[Uu]sage: git merge" broken/usage
 '
 
 test_expect_success 'reject non-strategy with a git-merge-foo name' '
-- 
1.7.12.92.gaa91cb5

Re: [PATCH v2 6/7] Fix tests under GETTEXT_POISON on git-remote

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:35

Jiang Xin [off-list ref] writes:
quoted hunk
Use i18n-specific test functions in test scripts for git-remote.
This issue was was introduced in v1.7.10-233-gbb16d5:

    bb16d5 i18n: remote: mark strings for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
...
@@ -77,6 +75,14 @@ test_expect_success 'add another remote' '
 )
 '
 
+test_expect_success C_LOCALE_OUTPUT 'add another remote' '
+(
+	cd test &&
+	check_remote_track origin master side &&
+	check_remote_track second master side another &&
+)
+'
This couldn't have possibly passed with the trailing &&, or am I
missing something?  There is already "add another remote" before
this test that adds "second" remote.  Is this test about "add
yet another remote", or is it checking the result of adding "second"
that was done in the previous step?

Will queue with an obvious fix-up with retitle, 'check tracking', or
something.

Thanks.

Re: [PATCH v2 6/7] Fix tests under GETTEXT_POISON on git-remote

From: Jiang Xin <hidden>
Date: 2016-06-15 22:54:35

2012/8/28 Junio C Hamano [off-list ref]:
Jiang Xin [off-list ref] writes:
quoted
Use i18n-specific test functions in test scripts for git-remote.
This issue was was introduced in v1.7.10-233-gbb16d5:

    bb16d5 i18n: remote: mark strings for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
...
@@ -77,6 +75,14 @@ test_expect_success 'add another remote' '
 )
 '

+test_expect_success C_LOCALE_OUTPUT 'add another remote' '
+(
+     cd test &&
+     check_remote_track origin master side &&
+     check_remote_track second master side another &&
+)
+'
This couldn't have possibly passed with the trailing &&, or am I
missing something?  There is already "add another remote" before
this test that adds "second" remote.  Is this test about "add
yet another remote", or is it checking the result of adding "second"
that was done in the previous step?
The trailing "&&“ is a copy & paste error. I only run my fixup in
GIT_GETTEXT_POISON mode in a harry, not noticed the bypassed
testcase has this serious bug.

I split the original "add another remote" into two blocks. One is a
normal testcase, and another has a C_LOCALE_OUTPUT prereq
flag. This is because other testcases depend on the operations in
"add another remote" testcase ('git remote add -f second ../two'),
and these testcases would fail if add C_LOCALE_OUTPUT
prereq to the whole "add another remote" testcase.
Will queue with an obvious fix-up with retitle, 'check tracking', or
something.

Thanks.


-- 
蒋鑫

北京群英汇信息技术有限公司
邮件: worldhello.net@gmail.com
网址: http://www.ossxp.com/
博客: http://www.worldhello.net/
微博: http://weibo.com/gotgit/
电话: 010-51262007, 18601196889
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help