diff options
-rwxr-xr-x | t/t0006-date.sh | 2 | ||||
-rwxr-xr-x | t/t0040-parse-options.sh | 34 | ||||
-rwxr-xr-x | t/t1300-repo-config.sh | 2 | ||||
-rwxr-xr-x | t/t1502-rev-parse-parseopt.sh | 2 | ||||
-rwxr-xr-x | t/t2006-checkout-index-basic.sh | 4 | ||||
-rwxr-xr-x | t/t2107-update-index-basic.sh | 4 | ||||
-rwxr-xr-x | t/t3004-ls-files-basic.sh | 4 | ||||
-rwxr-xr-x | t/t3200-branch.sh | 4 | ||||
-rwxr-xr-x | t/t3501-revert-cherry-pick.sh | 4 | ||||
-rwxr-xr-x | t/t3903-stash.sh | 2 | ||||
-rwxr-xr-x | t/t4006-diff-mode.sh | 8 | ||||
-rwxr-xr-x | t/t4012-diff-binary.sh | 4 | ||||
-rwxr-xr-x | t/t4120-apply-popt.sh | 4 | ||||
-rwxr-xr-x | t/t4133-apply-filenames.sh | 4 | ||||
-rwxr-xr-x | t/t4200-rerere.sh | 4 | ||||
-rwxr-xr-x | t/t4202-log.sh | 2 | ||||
-rwxr-xr-x | t/t4205-log-pretty-formats.sh | 4 | ||||
-rwxr-xr-x | t/t5300-pack-object.sh | 4 | ||||
-rwxr-xr-x | t/t5505-remote.sh | 28 | ||||
-rwxr-xr-x | t/t5530-upload-pack-error.sh | 4 | ||||
-rwxr-xr-x | t/t6500-gc.sh | 4 | ||||
-rwxr-xr-x | t/t7508-status.sh | 2 | ||||
-rwxr-xr-x | t/t7600-merge.sh | 2 |
23 files changed, 83 insertions, 53 deletions
diff --git a/t/t0006-date.sh b/t/t0006-date.sh index 1d29810a7a..e53cf6d36d 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 " } diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh index e3f354a45e..244a43c920 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 a477453e2e..e127f35db9 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 1efd7f76dd..13c88c9aae 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 b8559838b1..57cbdfe9bc 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 0dbbb00d74..a6405d318d 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_expect_success '--cacheinfo does not accept blob null sha1' ' diff --git a/t/t3004-ls-files-basic.sh b/t/t3004-ls-files-basic.sh index 490e052875..8d9bc3c2af 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 a17f8b2a40..1ffce2173e 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 595d2ff990..34c86e5de6 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/t3903-stash.sh b/t/t3903-stash.sh index cd042633ba..5dfbda7491 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 diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh index 7a3e1f9a24..3d4b1ba23f 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/t4012-diff-binary.sh b/t/t4012-diff-binary.sh index ec4deea192..1215ae544b 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 a33d510bf6..c5fecdfed4 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 94da99075c..2ecb4216b7 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 diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh index 3ab670d36a..7f6666fcd3 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/t4202-log.sh b/t/t4202-log.sh index 71be59d446..31869dc0db 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 4afd77815f..2c45de7aea 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/t5300-pack-object.sh b/t/t5300-pack-object.sh index 2e52f8b838..a07c871797 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/t5505-remote.sh b/t/t5505-remote.sh index e8af615e6d..88a21ff0bf 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 'check remote tracking' ' +( + 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 && ( diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh index 6b2a5f4a65..c983d3694c 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' ' diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh index 82f3639937..b1a63655f9 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/t7508-status.sh b/t/t7508-status.sh index c206f4777a..e313ef196e 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 diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index 9e27bbf902..5e19598fe7 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' ' |