diff options
Diffstat (limited to 't')
36 files changed, 343 insertions, 363 deletions
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh index d3829b8d0a..b8996a373a 100644 --- a/t/lib-httpd.sh +++ b/t/lib-httpd.sh @@ -157,8 +157,7 @@ test_http_push_nonff() { grep "^ ! \[rejected\][ ]*$BRANCH -> $BRANCH (non-fast-forward)$" output ' - test_expect_success C_LOCALE_OUTPUT 'non-fast-forward push shows help message' ' - grep "To prevent you from losing history, non-fast-forward updates were rejected" \ - output + test_expect_success 'non-fast-forward push shows help message' ' + test_i18ngrep "To prevent you from losing history, non-fast-forward updates were rejected" output ' } diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 54520f6fa6..8106af8fba 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -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' ' diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh index 3264fefbad..5e29e13782 100755 --- a/t/t1200-tutorial.sh +++ b/t/t1200-tutorial.sh @@ -166,8 +166,8 @@ test_expect_success 'git resolve' ' -e "s/^Fast[- ]forward /FASTFORWARD /" >resolve.output ' -test_expect_success C_LOCALE_OUTPUT 'git resolve output' ' - test_cmp resolve.expect resolve.output +test_expect_success 'git resolve output' ' + test_i18ncmp resolve.expect resolve.output ' cat > show-branch2.expect << EOF diff --git a/t/t2019-checkout-ambiguous-ref.sh b/t/t2019-checkout-ambiguous-ref.sh index cc34e5535b..b99d5192a9 100755 --- a/t/t2019-checkout-ambiguous-ref.sh +++ b/t/t2019-checkout-ambiguous-ref.sh @@ -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' ' @@ -51,9 +51,9 @@ test_expect_success VAGUENESS_SUCCESS 'checkout chooses branch over tag' ' test_cmp expect file ' -test_expect_success VAGUENESS_SUCCESS,C_LOCALE_OUTPUT 'checkout reports switch to branch' ' - grep "Switched to branch" stderr && - ! grep "^HEAD is now at" stderr +test_expect_success VAGUENESS_SUCCESS 'checkout reports switch to branch' ' + test_i18ngrep "Switched to branch" stderr && + test_i18ngrep ! "^HEAD is now at" stderr ' test_done diff --git a/t/t2020-checkout-detach.sh b/t/t2020-checkout-detach.sh index 569b27fe8d..2366f0f414 100755 --- a/t/t2020-checkout-detach.sh +++ b/t/t2020-checkout-detach.sh @@ -13,10 +13,10 @@ check_not_detached () { ORPHAN_WARNING='you are leaving .* commit.*behind' check_orphan_warning() { - grep "$ORPHAN_WARNING" "$1" + test_i18ngrep "$ORPHAN_WARNING" "$1" } check_no_orphan_warning() { - ! grep "$ORPHAN_WARNING" "$1" + test_i18ngrep ! "$ORPHAN_WARNING" "$1" } reset () { @@ -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 '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 '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 'checkout does not warn leaving reachable commit' ' check_no_orphan_warning stderr ' diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh index 856e7da1f2..2d7d3115d5 100755 --- a/t/t2200-add-update.sh +++ b/t/t2200-add-update.sh @@ -111,7 +111,7 @@ test_expect_success 'touch and then add explicitly' ' ' -test_expect_success C_LOCALE_OUTPUT 'add -n -u should not add but just report' ' +test_expect_success 'add -n -u should not add but just report' ' ( echo "add '\''check'\''" && @@ -124,7 +124,7 @@ test_expect_success C_LOCALE_OUTPUT 'add -n -u should not add but just report' ' after=$(git ls-files -s check top) && test "$before" = "$after" && - test_cmp expect actual + test_i18ncmp expect actual ' diff --git a/t/t2204-add-ignored.sh b/t/t2204-add-ignored.sh index 49753362f0..8340ac2f07 100755 --- a/t/t2204-add-ignored.sh +++ b/t/t2204-add-ignored.sh @@ -34,8 +34,8 @@ do ! test -s out ' - test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i output" ' - grep -e "Use -f if" err + test_expect_success "complaints for ignored $i output" ' + test_i18ngrep -e "Use -f if" err ' test_expect_success "complaints for ignored $i with unignored file" ' @@ -44,8 +44,8 @@ do git ls-files "$i" >out && ! test -s out ' - test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i with unignored file output" ' - grep -e "Use -f if" err + test_expect_success "complaints for ignored $i with unignored file output" ' + test_i18ngrep -e "Use -f if" err ' done @@ -61,10 +61,10 @@ do ) ' - test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i in dir output" ' + test_expect_success "complaints for ignored $i in dir output" ' ( cd dir && - grep -e "Use -f if" err + test_i18ngrep -e "Use -f if" err ) ' done @@ -81,10 +81,10 @@ do ) ' - test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i in sub output" ' + test_expect_success "complaints for ignored $i in sub output" ' ( cd sub && - grep -e "Use -f if" err + test_i18ngrep -e "Use -f if" err ) ' done diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh index 806fdccce1..0c02d56952 100755 --- a/t/t3030-merge-recursive.sh +++ b/t/t3030-merge-recursive.sh @@ -312,20 +312,20 @@ test_expect_success 'merge-recursive result' ' ' -test_expect_success C_LOCALE_OUTPUT 'fail if the index has unresolved entries' ' +test_expect_success 'fail if the index has unresolved entries' ' rm -fr [abcd] && git checkout -f "$c1" && test_must_fail git merge "$c5" && test_must_fail git merge "$c5" 2> out && - grep "not possible because you have unmerged files" out && + test_i18ngrep "not possible because you have unmerged files" out && git add -u && test_must_fail git merge "$c5" 2> out && - grep "You have not concluded your merge" out && + test_i18ngrep "You have not concluded your merge" out && rm -f .git/MERGE_HEAD && test_must_fail git merge "$c5" 2> out && - grep "Your local changes to the following files would be overwritten by merge:" out + test_i18ngrep "Your local changes to the following files would be overwritten by merge:" out ' test_expect_success 'merge-recursive remove conflict' ' diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 286a2a6869..0ce95c04e5 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -203,10 +203,12 @@ test_expect_success 'test deleting branch deletes branch config' \ test -z "$(git config branch.my7.remote)" && test -z "$(git config branch.my7.merge)"' -test_expect_success C_LOCALE_OUTPUT 'test deleting branch without config' \ +test_expect_success 'test deleting branch without config' \ 'git branch my7 s && sha1=$(git rev-parse my7 | cut -c 1-7) && - test "$(git branch -d my7 2>&1)" = "Deleted branch my7 (was $sha1)."' + echo "Deleted branch my7 (was $sha1)." >expect && + git branch -d my7 >actual 2>&1 && + test_i18ncmp expect actual' test_expect_success 'test --track without .fetch entries' \ 'git branch --track my8 && diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh index 4ef7d09115..6b7c118e4f 100755 --- a/t/t3203-branch-output.sh +++ b/t/t3203-branch-output.sh @@ -72,10 +72,10 @@ cat >expect <<'EOF' branch-two master EOF -test_expect_success C_LOCALE_OUTPUT 'git branch shows detached HEAD properly' ' +test_expect_success 'git branch shows detached HEAD properly' ' git checkout HEAD^0 && git branch >actual && - test_cmp expect actual + test_i18ncmp expect actual ' test_done diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh index 753a6c972c..595d2ff990 100755 --- a/t/t3501-revert-cherry-pick.sh +++ b/t/t3501-revert-cherry-pick.sh @@ -91,12 +91,12 @@ test_expect_success 'cherry-pick on stat-dirty working tree' ' ) ' -test_expect_success C_LOCALE_OUTPUT 'revert forbidden on dirty working tree' ' +test_expect_success 'revert forbidden on dirty working tree' ' echo content >extra_file && git add extra_file && test_must_fail git revert HEAD 2>errors && - grep "Your local changes would be overwritten by " errors + test_i18ngrep "Your local changes would be overwritten by " errors ' diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh index c0c8330c20..212ec54aaf 100755 --- a/t/t3507-cherry-pick-conflict.sh +++ b/t/t3507-cherry-pick-conflict.sh @@ -44,7 +44,7 @@ test_expect_success 'failed cherry-pick does not advance HEAD' ' test "$head" = "$newhead" ' -test_expect_success C_LOCALE_OUTPUT 'advice from failed cherry-pick' " +test_expect_success 'advice from failed cherry-pick' " pristine_detach initial && picked=\$(git rev-parse --short picked) && @@ -56,7 +56,7 @@ test_expect_success C_LOCALE_OUTPUT 'advice from failed cherry-pick' " EOF test_must_fail git cherry-pick picked 2>actual && - test_cmp expected actual + test_i18ncmp expected actual " test_expect_success 'failed cherry-pick sets CHERRY_PICK_HEAD' ' diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 7de42faf48..575d9508a0 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -271,9 +271,9 @@ test_expect_success 'git add --dry-run of non-existing file' " test_must_fail git add --dry-run track-this ignored-file >actual 2>&1 " -test_expect_success C_LOCALE_OUTPUT 'git add --dry-run of an existing file output' " +test_expect_success 'git add --dry-run of an existing file output' " echo \"fatal: pathspec 'ignored-file' did not match any files\" >expect && - test_cmp expect actual + test_i18ncmp expect actual " cat >expect.err <<\EOF @@ -290,9 +290,9 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file' ' test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err ' -test_expect_success C_LOCALE_OUTPUT 'git add --dry-run --ignore-missing of non-existing file output' ' - test_cmp expect.out actual.out && - test_cmp expect.err actual.err +test_expect_success 'git add --dry-run --ignore-missing of non-existing file output' ' + test_i18ncmp expect.out actual.out && + test_i18ncmp expect.err actual.err ' test_done diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh index 3dadf9b316..844277cfa6 100755 --- a/t/t4001-diff-rename.sh +++ b/t/t4001-diff-rename.sh @@ -64,18 +64,18 @@ test_expect_success \ 'validate the output.' \ 'compare_diff_patch current expected' -test_expect_success C_LOCALE_OUTPUT 'favour same basenames over different ones' ' +test_expect_success 'favour same basenames over different ones' ' cp path1 another-path && git add another-path && git commit -m 1 && git rm path1 && mkdir subdir && git mv another-path subdir/path1 && - git status | grep "renamed: .*path1 -> subdir/path1"' + git status | test_i18ngrep "renamed: .*path1 -> subdir/path1"' -test_expect_success C_LOCALE_OUTPUT 'favour same basenames even with minor differences' ' +test_expect_success 'favour same basenames even with minor differences' ' git show HEAD:path1 | sed "s/15/16/" > subdir/path1 && - git status | grep "renamed: .*path1 -> subdir/path1"' + git status | test_i18ngrep "renamed: .*path1 -> subdir/path1"' test_expect_success 'setup for many rename source candidates' ' git reset --hard && diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index c3cdb52053..37a4109c97 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -614,13 +614,13 @@ echo "fatal: --name-only does not make sense" > expect.name-only echo "fatal: --name-status does not make sense" > expect.name-status echo "fatal: --check does not make sense" > expect.check -test_expect_success C_LOCALE_OUTPUT 'options no longer allowed for format-patch' ' +test_expect_success 'options no longer allowed for format-patch' ' test_must_fail git format-patch --name-only 2> output && - test_cmp expect.name-only output && + test_i18ncmp expect.name-only output && test_must_fail git format-patch --name-status 2> output && - test_cmp expect.name-status output && + test_i18ncmp expect.name-status output && test_must_fail git format-patch --check 2> output && - test_cmp expect.check output' + test_i18ncmp expect.check output' test_expect_success 'format-patch --numstat should produce a patch' ' git format-patch --numstat --stdout master..side > output && diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh index af78e21ba9..a1fddd4d15 100755 --- a/t/t5526-fetch-submodules.sh +++ b/t/t5526-fetch-submodules.sh @@ -66,12 +66,9 @@ test_expect_success "fetch --recurse-submodules recurses into submodules" ' ( cd downstream && git fetch --recurse-submodules >../actual.out 2>../actual.err - ) -' - -test_expect_success C_LOCALE_OUTPUT "fetch --recurse-submodules recurses into submodules: output" ' - test_cmp expect.out actual.out && - test_cmp expect.err actual.err + ) && + test_i18ncmp expect.out actual.out && + test_i18ncmp expect.err actual.err ' test_expect_success "fetch alone only fetches superproject" ' @@ -98,12 +95,9 @@ test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses i cd downstream && git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true && git fetch >../actual.out 2>../actual.err - ) -' - -test_expect_success C_LOCALE_OUTPUT "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" ' - test_cmp expect.out actual.out && - test_cmp expect.err actual.err + ) && + test_i18ncmp expect.out actual.out && + test_i18ncmp expect.err actual.err ' test_expect_success "--no-recurse-submodules overrides .gitmodules config" ' @@ -132,12 +126,9 @@ test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setti git fetch --recurse-submodules >../actual.out 2>../actual.err && git config --unset -f .gitmodules submodule.submodule.fetchRecurseSubmodules && git config --unset submodule.submodule.fetchRecurseSubmodules - ) -' - -test_expect_success C_LOCALE_OUTPUT "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config: output" ' - test_cmp expect.out actual.out && - test_cmp expect.err actual.err + ) && + test_i18ncmp expect.out actual.out && + test_i18ncmp expect.err actual.err ' test_expect_success "--quiet propagates to submodules" ' @@ -154,24 +145,18 @@ test_expect_success "--dry-run propagates to submodules" ' ( cd downstream && git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err - ) -' - -test_expect_success C_LOCALE_OUTPUT "--dry-run propagates to submodules: output" ' - test_cmp expect.out actual.out && - test_cmp expect.err actual.err + ) && + test_i18ncmp expect.out actual.out && + test_i18ncmp expect.err actual.err ' test_expect_success "Without --dry-run propagates to submodules" ' ( cd downstream && git fetch --recurse-submodules >../actual.out 2>../actual.err - ) -' - -test_expect_success C_LOCALE_OUTPUT "Without --dry-run propagates to submodules: output" ' - test_cmp expect.out actual.out && - test_cmp expect.err actual.err + ) && + test_i18ncmp expect.out actual.out && + test_i18ncmp expect.err actual.err ' test_expect_success "recurseSubmodules=true propagates into submodules" ' @@ -180,12 +165,9 @@ test_expect_success "recurseSubmodules=true propagates into submodules" ' cd downstream && git config fetch.recurseSubmodules true git fetch >../actual.out 2>../actual.err - ) -' - -test_expect_success C_LOCALE_OUTPUT "recurseSubmodules=true propagates into submodules: output" ' - test_cmp expect.out actual.out && - test_cmp expect.err actual.err + ) && + test_i18ncmp expect.out actual.out && + test_i18ncmp expect.err actual.err ' test_expect_success "--recurse-submodules overrides config in submodule" ' @@ -197,12 +179,9 @@ test_expect_success "--recurse-submodules overrides config in submodule" ' git config fetch.recurseSubmodules false ) && git fetch --recurse-submodules >../actual.out 2>../actual.err - ) -' - -test_expect_success C_LOCALE_OUTPUT "--recurse-submodules overrides config in submodule: output" ' - test_cmp expect.out actual.out && - test_cmp expect.err actual.err + ) && + test_i18ncmp expect.out actual.out && + test_i18ncmp expect.err actual.err ' test_expect_success "--no-recurse-submodules overrides config setting" ' @@ -243,8 +222,8 @@ test_expect_success "Recursion stops when no new submodule commits are fetched" cd downstream && git fetch >../actual.out 2>../actual.err ) && - test_cmp expect.err.sub actual.err && - test_cmp expect.out.sub actual.out + test_i18ncmp expect.err.sub actual.err && + test_i18ncmp expect.out.sub actual.out ' test_expect_success "Recursion doesn't happen when new superproject commits don't change any submodules" ' @@ -261,7 +240,7 @@ test_expect_success "Recursion doesn't happen when new superproject commits don' git fetch >../actual.out 2>../actual.err ) && ! test -s actual.out && - test_cmp expect.err.file actual.err + test_i18ncmp expect.err.file actual.err ' test_expect_success "Recursion picks up config in submodule" ' @@ -289,8 +268,8 @@ test_expect_success "Recursion picks up config in submodule" ' git config --unset fetch.recurseSubmodules ) ) && - test_cmp expect.err.sub actual.err && - test_cmp expect.out actual.out + test_i18ncmp expect.err.sub actual.err && + test_i18ncmp expect.out actual.out ' test_expect_success "Recursion picks up all submodules when necessary" ' @@ -321,8 +300,8 @@ test_expect_success "Recursion picks up all submodules when necessary" ' cd downstream && git fetch >../actual.out 2>../actual.err ) && - test_cmp expect.err.2 actual.err && - test_cmp expect.out actual.out + test_i18ncmp expect.err.2 actual.err && + test_i18ncmp expect.out actual.out ' test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no new commits are fetched in the superproject (and ignores config)" ' @@ -375,8 +354,8 @@ test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necess git config --unset -f .gitmodules submodule.deepsubmodule.fetchRecursive ) ) && - test_cmp expect.out actual.out && - test_cmp expect.err actual.err + test_i18ncmp expect.out actual.out && + test_i18ncmp expect.err actual.err ' test_expect_success "'--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" ' @@ -393,7 +372,7 @@ test_expect_success "'--recurse-submodules=on-demand' stops when no new submodul git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err ) && ! test -s actual.out && - test_cmp expect.err.file actual.err + test_i18ncmp expect.err.file actual.err ' test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config" ' @@ -420,8 +399,8 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config cd downstream && git config --unset fetch.recurseSubmodules ) && - test_cmp expect.out.sub actual.out && - test_cmp expect.err.2 actual.err + test_i18ncmp expect.out.sub actual.out && + test_i18ncmp expect.err.2 actual.err ' test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" ' @@ -448,8 +427,8 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override cd downstream && git config --unset submodule.submodule.fetchRecurseSubmodules ) && - test_cmp expect.out.sub actual.out && - test_cmp expect.err.2 actual.err + test_i18ncmp expect.out.sub actual.out && + test_i18ncmp expect.err.2 actual.err ' test_expect_success "don't fetch submodule when newly recorded commits are already present" ' @@ -468,7 +447,7 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea git fetch >../actual.out 2>../actual.err ) && ! test -s actual.out && - test_cmp expect.err actual.err + test_i18ncmp expect.err actual.err ' test_done diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh index 0492877d51..d924056c8a 100755 --- a/t/t5541-http-push.sh +++ b/t/t5541-http-push.sh @@ -135,8 +135,8 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output ' -test_expect_success C_LOCALE_OUTPUT 'push fails for non-fast-forward refs unmatched by remote helper: our output' ' - grep "To prevent you from losing history, non-fast-forward updates were rejected" \ +test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: our output' ' + test_i18ngrep "To prevent you from losing history, non-fast-forward updates were rejected" \ output ' diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 5a068b21e4..151ea531bd 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -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 '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 diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh index 6c3719141a..a9b0ac1efc 100755 --- a/t/t6040-tracking-info.sh +++ b/t/t6040-tracking-info.sh @@ -42,13 +42,13 @@ b3 behind 1 b4 ahead 2 EOF -test_expect_success C_LOCALE_OUTPUT 'branch -v' ' +test_expect_success 'branch -v' ' ( cd test && git branch -v ) | sed -n -e "$script" >actual && - test_cmp expect actual + test_i18ncmp expect actual ' test_expect_success 'checkout' ' diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index 1826996245..f67aa6ff6a 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -123,8 +123,8 @@ cat - >err.expect <<EOF warning: tag 'A' is really 'Q' here EOF check_describe A-* HEAD -test_expect_success C_LOCALE_OUTPUT 'warning was displayed for Q' ' - test_cmp err.expect err.actual +test_expect_success 'warning was displayed for Q' ' + test_i18ncmp err.expect err.actual ' test_expect_success 'rename tag Q back to A' ' mv .git/refs/tags/Q .git/refs/tags/A diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 1dedfd0c83..2ac1c66079 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -1120,13 +1120,11 @@ test_expect_success \ ! (GIT_EDITOR=cat git tag -a initial-comment > actual) ' -test_expect_success \ - C_LOCALE_OUTPUT \ - 'message in editor has initial comment: first line' ' +test_expect_success 'message in editor has initial comment: first line' ' # check the first line --- should be empty echo >first.expect && sed -e 1q <actual >first.actual && - test_cmp first.expect first.actual + test_i18ncmp first.expect first.actual ' test_expect_success \ diff --git a/t/t7012-skip-worktree-writing.sh b/t/t7012-skip-worktree-writing.sh index 14fcb1c7f5..cffb2696d4 100755 --- a/t/t7012-skip-worktree-writing.sh +++ b/t/t7012-skip-worktree-writing.sh @@ -124,16 +124,16 @@ cat >expected <<EOF Would remove expected Would remove result EOF -test_expect_success C_LOCALE_OUTPUT 'git-clean, absent case' ' +test_expect_success 'git-clean, absent case' ' setup_absent && git clean -n > result && - test_cmp expected result + test_i18ncmp expected result ' -test_expect_success C_LOCALE_OUTPUT 'git-clean, dirty case' ' +test_expect_success 'git-clean, dirty case' ' setup_dirty && git clean -n > result && - test_cmp expected result + test_i18ncmp expected result ' #TODO test_expect_failure 'git-apply adds file' false diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh index 3a5d927f83..b8cb4906aa 100755 --- a/t/t7060-wtstatus.sh +++ b/t/t7060-wtstatus.sh @@ -38,7 +38,7 @@ cat >expect <<EOF no changes added to commit (use "git add" and/or "git commit -a") EOF -test_expect_success C_LOCALE_OUTPUT 'M/D conflict does not segfault' ' +test_expect_success 'M/D conflict does not segfault' ' mkdir mdconflict && ( cd mdconflict && @@ -50,9 +50,9 @@ test_expect_success C_LOCALE_OUTPUT 'M/D conflict does not segfault' ' git commit -m delete && test_must_fail git merge master && test_must_fail git commit --dry-run >../actual && - test_cmp ../expect ../actual && + test_i18ncmp ../expect ../actual && git status >../actual && - test_cmp ../expect ../actual + test_i18ncmp ../expect ../actual ) ' diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 7be2ff38fc..f1cfc9ac95 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -423,10 +423,10 @@ Unstaged changes after reset: M file2 EOF -test_expect_success C_LOCALE_OUTPUT '--mixed refreshes the index' ' +test_expect_success '--mixed refreshes the index' ' echo 123 >> file2 && git reset --mixed HEAD > output && - test_cmp expect output + test_i18ncmp expect output ' test_expect_success 'disambiguation (1)' ' diff --git a/t/t7110-reset-merge.sh b/t/t7110-reset-merge.sh index b42820ad69..a82a07a04a 100755 --- a/t/t7110-reset-merge.sh +++ b/t/t7110-reset-merge.sh @@ -233,11 +233,11 @@ test_expect_success '"reset --merge HEAD^" is ok with pending merge' ' # working index HEAD target working index HEAD # ---------------------------------------------------- # file1: X U B C --keep (disallowed) -test_expect_success C_LOCALE_OUTPUT '"reset --keep HEAD^" fails with pending merge' ' +test_expect_success '"reset --keep HEAD^" fails with pending merge' ' git reset --hard third && test_must_fail git merge branch1 && test_must_fail git reset --keep HEAD^ 2>err.log && - grep "middle of a merge" err.log + test_i18ngrep "middle of a merge" err.log ' # The next test will test the following: @@ -259,11 +259,11 @@ test_expect_success '"reset --merge HEAD" is ok with pending merge' ' # working index HEAD target working index HEAD # ---------------------------------------------------- # file1: X U B B --keep (disallowed) -test_expect_success C_LOCALE_OUTPUT '"reset --keep HEAD" fails with pending merge' ' +test_expect_success '"reset --keep HEAD" fails with pending merge' ' git reset --hard third && test_must_fail git merge branch1 && test_must_fail git reset --keep HEAD 2>err.log && - grep "middle of a merge" err.log + test_i18ngrep "middle of a merge" err.log ' test_expect_success '--merge is ok with added/deleted merge' ' @@ -280,7 +280,7 @@ test_expect_success '--merge is ok with added/deleted merge' ' git diff --exit-code --cached ' -test_expect_success C_LOCALE_OUTPUT '--keep fails with added/deleted merge' ' +test_expect_success '--keep fails with added/deleted merge' ' git reset --hard third && rm -f file2 && test_must_fail git merge branch3 && @@ -289,7 +289,7 @@ test_expect_success C_LOCALE_OUTPUT '--keep fails with added/deleted merge' ' git diff --exit-code file3 && git diff --exit-code branch3 file3 && test_must_fail git reset --keep HEAD 2>err.log && - grep "middle of a merge" err.log + test_i18ngrep "middle of a merge" err.log ' test_done diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 37ed0931d9..07fb53adcb 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -223,12 +223,12 @@ test_expect_success 'checkout --merge --conflict=diff3 <branch>' ' test_cmp two expect ' -test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD (with advice declined)' ' +test_expect_success 'checkout to detach HEAD (with advice declined)' ' git config advice.detachedHead false && git checkout -f renamer && git clean -f && git checkout renamer^ 2>messages && - grep "HEAD is now at 7329388" messages && + test_i18ngrep "HEAD is now at 7329388" messages && test 1 -eq $(wc -l <messages) && H=$(git rev-parse --verify HEAD) && M=$(git show-ref -s --verify refs/heads/master) && @@ -242,11 +242,11 @@ test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD (with advice declin fi ' -test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD' ' +test_expect_success 'checkout to detach HEAD' ' git config advice.detachedHead true && git checkout -f renamer && git clean -f && git checkout renamer^ 2>messages && - grep "HEAD is now at 7329388" messages && + test_i18ngrep "HEAD is now at 7329388" messages && test 1 -lt $(wc -l <messages) && H=$(git rev-parse --verify HEAD) && M=$(git show-ref -s --verify refs/heads/master) && @@ -260,7 +260,7 @@ test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD' ' fi ' -test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with branchname^' ' +test_expect_success 'checkout to detach HEAD with branchname^' ' git checkout -f master && git clean -f && git checkout renamer^ && @@ -276,7 +276,7 @@ test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with branchname^' ' fi ' -test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with :/message' ' +test_expect_success 'checkout to detach HEAD with :/message' ' git checkout -f master && git clean -f && git checkout ":/Initial" && @@ -292,7 +292,7 @@ test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with :/message' ' fi ' -test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with HEAD^0' ' +test_expect_success 'checkout to detach HEAD with HEAD^0' ' git checkout -f master && git clean -f && git checkout HEAD^0 && diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh index bcdf0847d0..47096f9014 100755 --- a/t/t7500-commit.sh +++ b/t/t7500-commit.sh @@ -15,7 +15,7 @@ commit_msg_is () { printf "%s" "$(git log --pretty=format:%s%b -1)" >$expect && printf "%s" "$1" >$actual && - test_cmp $expect $actual + test_i18ncmp $expect $actual } # A sanity check to see if commit is working at all. @@ -72,7 +72,7 @@ test_expect_success 'adding comments to a template should not commit' ' ) ' -test_expect_success C_LOCALE_OUTPUT 'adding real content to a template should commit' ' +test_expect_success 'adding real content to a template should commit' ' ( test_set_editor "$TEST_DIRECTORY"/t7500/add-content && git commit --template "$TEMPLATE" @@ -80,7 +80,7 @@ test_expect_success C_LOCALE_OUTPUT 'adding real content to a template should co commit_msg_is "template linecommit message" ' -test_expect_success C_LOCALE_OUTPUT '-t option should be short for --template' ' +test_expect_success '-t option should be short for --template' ' echo "short template" > "$TEMPLATE" && echo "new content" >> foo && git add foo && @@ -91,7 +91,7 @@ test_expect_success C_LOCALE_OUTPUT '-t option should be short for --template' ' commit_msg_is "short templatecommit message" ' -test_expect_success C_LOCALE_OUTPUT 'config-specified template should commit' ' +test_expect_success 'config-specified template should commit' ' echo "new template" > "$TEMPLATE" && git config commit.template "$TEMPLATE" && echo "more content" >> foo && @@ -290,7 +290,7 @@ test_expect_success 'commit --squash works with -c for same commit' ' commit_msg_is "squash! edited commit" ' -test_expect_success C_LOCALE_OUTPUT 'commit --squash works with editor' ' +test_expect_success 'commit --squash works with editor' ' commit_for_rebase_autosquash_setup && test_set_editor "$TEST_DIRECTORY"/t7500/add-content && git commit --squash HEAD~1 && diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index a76c474195..7f7f7c7b95 100755 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -16,9 +16,10 @@ test_expect_success \ "echo 'bongo bongo' >file && git add file" -test_expect_success C_LOCALE_OUTPUT \ - "Constructing initial commit" \ - "git status | grep 'Initial commit'" +test_expect_success "Constructing initial commit" ' + git status >actual && + test_i18ngrep "Initial commit" actual +' test_expect_success \ "fail initial amend" \ diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh index cfb569eaba..3f3adc31b9 100755 --- a/t/t7502-commit.sh +++ b/t/t7502-commit.sh @@ -22,10 +22,7 @@ check_summary_oneline() { SUMMARY_POSTFIX="$(git log -1 --pretty='format:%h')" echo "[$SUMMARY_PREFIX $SUMMARY_POSTFIX] $2" >exp && - if test_have_prereq C_LOCALE_OUTPUT - then - test_cmp exp act - fi + test_i18ncmp exp act } test_expect_success 'output summary format' ' @@ -234,23 +231,19 @@ echo "sample # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit." >expect -test_expect_success C_LOCALE_OUTPUT 'cleanup commit messages (strip,-F,-e): output' ' - test_cmp expect actual +test_expect_success 'cleanup commit messages (strip,-F,-e): output' ' + test_i18ncmp expect actual ' echo "# # Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> #" >> expect -test_expect_success C_LOCALE_OUTPUT 'author different from committer' ' - +test_expect_success 'author different from committer' ' echo >>negative && - git commit -e -m "sample" - head -n 7 .git/COMMIT_EDITMSG >actual -' - -test_expect_success C_LOCALE_OUTPUT 'author different from committer: output' ' - test_cmp expect actual + test_might_fail git commit -e -m "sample" && + head -n 7 .git/COMMIT_EDITMSG >actual && + test_i18ncmp expect actual ' mv expect expect.tmp @@ -259,7 +252,7 @@ rm -f expect.tmp echo "# Committer: #" >> expect -test_expect_success C_LOCALE_OUTPUT 'committer is automatic' ' +test_expect_success 'committer is automatic' ' echo >>negative && ( @@ -270,10 +263,7 @@ test_expect_success C_LOCALE_OUTPUT 'committer is automatic' ' ) && head -n 8 .git/COMMIT_EDITMSG | \ sed "s/^# Committer: .*/# Committer:/" >actual -' - -test_expect_success C_LOCALE_OUTPUT 'committer is automatic: output' ' - test_cmp expect actual + test_i18ncmp expect actual ' pwd=`pwd` @@ -376,78 +366,78 @@ try_commit () { GIT_EDITOR=.git/FAKE_EDITOR git commit -a $* $use_template && case "$use_template" in '') - ! grep "^## Custom template" .git/COMMIT_EDITMSG ;; + test_i18ngrep ! "^## Custom template" .git/COMMIT_EDITMSG ;; *) - grep "^## Custom template" .git/COMMIT_EDITMSG ;; + test_i18ngrep "^## Custom template" .git/COMMIT_EDITMSG ;; esac } try_commit_status_combo () { - test_expect_success C_LOCALE_OUTPUT 'commit' ' + test_expect_success 'commit' ' clear_config commit.status && try_commit "" && - grep "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG ' - test_expect_success C_LOCALE_OUTPUT 'commit' ' + test_expect_success 'commit' ' clear_config commit.status && try_commit "" && - grep "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG ' - test_expect_success C_LOCALE_OUTPUT 'commit --status' ' + test_expect_success 'commit --status' ' clear_config commit.status && try_commit --status && - grep "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG ' - test_expect_success C_LOCALE_OUTPUT 'commit --no-status' ' + test_expect_success 'commit --no-status' ' clear_config commit.status && try_commit --no-status && - ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG ' - test_expect_success C_LOCALE_OUTPUT 'commit with commit.status = yes' ' + test_expect_success 'commit with commit.status = yes' ' clear_config commit.status && git config commit.status yes && try_commit "" && - grep "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG ' - test_expect_success C_LOCALE_OUTPUT 'commit with commit.status = no' ' + test_expect_success 'commit with commit.status = no' ' clear_config commit.status && git config commit.status no && try_commit "" && - ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG ' - test_expect_success C_LOCALE_OUTPUT 'commit --status with commit.status = yes' ' + test_expect_success 'commit --status with commit.status = yes' ' clear_config commit.status && git config commit.status yes && try_commit --status && - grep "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG ' - test_expect_success C_LOCALE_OUTPUT 'commit --no-status with commit.status = yes' ' + test_expect_success 'commit --no-status with commit.status = yes' ' clear_config commit.status && git config commit.status yes && try_commit --no-status && - ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG ' - test_expect_success C_LOCALE_OUTPUT 'commit --status with commit.status = no' ' + test_expect_success 'commit --status with commit.status = no' ' clear_config commit.status && git config commit.status no && try_commit --status && - grep "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG ' - test_expect_success C_LOCALE_OUTPUT 'commit --no-status with commit.status = no' ' + test_expect_success 'commit --no-status with commit.status = no' ' clear_config commit.status && git config commit.status no && try_commit --no-status && - ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG ' } diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh index c56733253f..c8d50a6567 100755 --- a/t/t7506-status-submodule.sh +++ b/t/t7506-status-submodule.sh @@ -20,21 +20,21 @@ test_expect_success 'setup' ' git commit -m "Add submodule sub" ' -test_expect_success C_LOCALE_OUTPUT 'status clean' ' +test_expect_success 'status clean' ' git status >output && - grep "nothing to commit" output + test_i18ngrep "nothing to commit" output ' -test_expect_success C_LOCALE_OUTPUT 'commit --dry-run -a clean' ' +test_expect_success 'commit --dry-run -a clean' ' test_must_fail git commit --dry-run -a >output && - grep "nothing to commit" output + test_i18ngrep "nothing to commit" output ' -test_expect_success C_LOCALE_OUTPUT 'status with modified file in submodule' ' +test_expect_success 'status with modified file in submodule' ' (cd sub && git reset --hard) && echo "changed" >sub/foo && git status >output && - grep "modified: sub (modified content)" output + test_i18ngrep "modified: sub (modified content)" output ' test_expect_success 'status with modified file in submodule (porcelain)' ' @@ -46,10 +46,10 @@ test_expect_success 'status with modified file in submodule (porcelain)' ' EOF ' -test_expect_success C_LOCALE_OUTPUT 'status with added file in submodule' ' +test_expect_success 'status with added file in submodule' ' (cd sub && git reset --hard && echo >foo && git add foo) && git status >output && - grep "modified: sub (modified content)" output + test_i18ngrep "modified: sub (modified content)" output ' test_expect_success 'status with added file in submodule (porcelain)' ' @@ -60,16 +60,16 @@ test_expect_success 'status with added file in submodule (porcelain)' ' EOF ' -test_expect_success C_LOCALE_OUTPUT 'status with untracked file in submodule' ' +test_expect_success 'status with untracked file in submodule' ' (cd sub && git reset --hard) && echo "content" >sub/new-file && git status >output && - grep "modified: sub (untracked content)" output + test_i18ngrep "modified: sub (untracked content)" output ' -test_expect_success C_LOCALE_OUTPUT 'status -uno with untracked file in submodule' ' +test_expect_success 'status -uno with untracked file in submodule' ' git status -uno >output && - grep "^nothing to commit" output + test_i18ngrep "^nothing to commit" output ' test_expect_success 'status with untracked file in submodule (porcelain)' ' @@ -79,11 +79,11 @@ test_expect_success 'status with untracked file in submodule (porcelain)' ' EOF ' -test_expect_success C_LOCALE_OUTPUT 'status with added and untracked file in submodule' ' +test_expect_success 'status with added and untracked file in submodule' ' (cd sub && git reset --hard && echo >foo && git add foo) && echo "content" >sub/new-file && git status >output && - grep "modified: sub (modified content, untracked content)" output + test_i18ngrep "modified: sub (modified content, untracked content)" output ' test_expect_success 'status with added and untracked file in submodule (porcelain)' ' @@ -95,13 +95,13 @@ test_expect_success 'status with added and untracked file in submodule (porcelai EOF ' -test_expect_success C_LOCALE_OUTPUT 'status with modified file in modified submodule' ' +test_expect_success 'status with modified file in modified submodule' ' (cd sub && git reset --hard) && rm sub/new-file && (cd sub && echo "next change" >foo && git commit -m "next change" foo) && echo "changed" >sub/foo && git status >output && - grep "modified: sub (new commits, modified content)" output + test_i18ngrep "modified: sub (new commits, modified content)" output ' test_expect_success 'status with modified file in modified submodule (porcelain)' ' @@ -113,10 +113,10 @@ test_expect_success 'status with modified file in modified submodule (porcelain) EOF ' -test_expect_success C_LOCALE_OUTPUT 'status with added file in modified submodule' ' +test_expect_success 'status with added file in modified submodule' ' (cd sub && git reset --hard && echo >foo && git add foo) && git status >output && - grep "modified: sub (new commits, modified content)" output + test_i18ngrep "modified: sub (new commits, modified content)" output ' test_expect_success 'status with added file in modified submodule (porcelain)' ' @@ -127,11 +127,11 @@ test_expect_success 'status with added file in modified submodule (porcelain)' ' EOF ' -test_expect_success C_LOCALE_OUTPUT 'status with untracked file in modified submodule' ' +test_expect_success 'status with untracked file in modified submodule' ' (cd sub && git reset --hard) && echo "content" >sub/new-file && git status >output && - grep "modified: sub (new commits, untracked content)" output + test_i18ngrep "modified: sub (new commits, untracked content)" output ' test_expect_success 'status with untracked file in modified submodule (porcelain)' ' @@ -141,11 +141,11 @@ test_expect_success 'status with untracked file in modified submodule (porcelain EOF ' -test_expect_success C_LOCALE_OUTPUT 'status with added and untracked file in modified submodule' ' +test_expect_success 'status with added and untracked file in modified submodule' ' (cd sub && git reset --hard && echo >foo && git add foo) && echo "content" >sub/new-file && git status >output && - grep "modified: sub (new commits, modified content, untracked content)" output + test_i18ngrep "modified: sub (new commits, modified content, untracked content)" output ' test_expect_success 'status with added and untracked file in modified submodule (porcelain)' ' @@ -167,24 +167,24 @@ test_expect_success 'setup .git file for sub' ' git commit -m "added .real to .gitignore" .gitignore ' -test_expect_success C_LOCALE_OUTPUT 'status with added file in modified submodule with .git file' ' +test_expect_success 'status with added file in modified submodule with .git file' ' (cd sub && git reset --hard && echo >foo && git add foo) && git status >output && - grep "modified: sub (new commits, modified content)" output + test_i18ngrep "modified: sub (new commits, modified content)" output ' test_expect_success 'rm submodule contents' ' rm -rf sub/* sub/.git ' -test_expect_success C_LOCALE_OUTPUT 'status clean (empty submodule dir)' ' +test_expect_success 'status clean (empty submodule dir)' ' git status >output && - grep "nothing to commit" output + test_i18ngrep "nothing to commit" output ' -test_expect_success C_LOCALE_OUTPUT 'status -a clean (empty submodule dir)' ' +test_expect_success 'status -a clean (empty submodule dir)' ' test_must_fail git commit --dry-run -a >output && - grep "nothing to commit" output + test_i18ngrep "nothing to commit" output ' test_done diff --git a/t/t7508-status.sh b/t/t7508-status.sh index a93e70fac4..cd6e2c5e87 100755 --- a/t/t7508-status.sh +++ b/t/t7508-status.sh @@ -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' ' diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index 87d5d788cb..e84e822219 100755 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@ -495,10 +495,10 @@ test_expect_success 'merge fast-forward in a dirty tree' ' test_debug 'git log --graph --decorate --oneline --all' -test_expect_success C_LOCALE_OUTPUT 'in-index merge' ' +test_expect_success 'in-index merge' ' git reset --hard c0 && git merge --no-ff -s resolve c1 >out && - grep "Wonderful." out && + test_i18ngrep "Wonderful." out && verify_parents $c0 $c1 ' diff --git a/t/t7607-merge-overwrite.sh b/t/t7607-merge-overwrite.sh index ef84f04102..72a8731d5e 100755 --- a/t/t7607-merge-overwrite.sh +++ b/t/t7607-merge-overwrite.sh @@ -150,11 +150,8 @@ test_expect_success 'will not overwrite untracked file on unborn branch' ' git rm -fr . && git checkout --orphan new && cp important c0.c && - test_must_fail git merge c0 2>out -' - -test_expect_success C_LOCALE_OUTPUT 'will not overwrite untracked file on unborn branch: output' ' - test_cmp out expect + test_must_fail git merge c0 2>out && + test_i18ncmp out expect ' test_expect_success 'will not overwrite untracked file on unborn branch .git/MERGE_HEAD sanity etc.' ' diff --git a/t/t7611-merge-abort.sh b/t/t7611-merge-abort.sh index cdb3f444cd..7b4798e8e4 100755 --- a/t/t7611-merge-abort.sh +++ b/t/t7611-merge-abort.sh @@ -46,11 +46,8 @@ test_expect_success 'setup' ' pre_merge_head="$(git rev-parse HEAD)" test_expect_success 'fails without MERGE_HEAD (unstarted merge)' ' - test_must_fail git merge --abort 2>output -' - -test_expect_success C_LOCALE_OUTPUT 'fails without MERGE_HEAD (unstarted merge): fatal output' ' - grep -q MERGE_HEAD output + test_must_fail git merge --abort 2>output && + test_i18ngrep MERGE_HEAD output ' test_expect_success 'fails without MERGE_HEAD (unstarted merge): .git/MERGE_HEAD sanity' ' @@ -63,11 +60,8 @@ test_expect_success 'fails without MERGE_HEAD (completed merge)' ' test ! -f .git/MERGE_HEAD && # Merge successfully completed post_merge_head="$(git rev-parse HEAD)" && - test_must_fail git merge --abort 2>output -' - -test_expect_success C_LOCALE_OUTPUT 'fails without MERGE_HEAD (completed merge): output' ' - grep -q MERGE_HEAD output + test_must_fail git merge --abort 2>output && + test_i18ngrep MERGE_HEAD output ' test_expect_success 'fails without MERGE_HEAD (completed merge): .git/MERGE_HEAD sanity' ' diff --git a/t/t7811-grep-open.sh b/t/t7811-grep-open.sh index aedf484fee..a8957782cf 100755 --- a/t/t7811-grep-open.sh +++ b/t/t7811-grep-open.sh @@ -61,9 +61,9 @@ test_expect_success SIMPLEPAGER 'git grep -O' ' test_cmp empty out ' -test_expect_success C_LOCALE_OUTPUT 'git grep -O --cached' ' +test_expect_success 'git grep -O --cached' ' test_must_fail git grep --cached -O GREP_PATTERN >out 2>msg && - grep open-files-in-pager msg + test_i18ngrep open-files-in-pager msg ' test_expect_success 'git grep -O --no-index' ' diff --git a/t/test-lib.sh b/t/test-lib.sh index aca03d2db0..c5b18e282a 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1079,6 +1079,32 @@ 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 "$@" +} + +# Use this instead of "grep expected-string actual" to see if the +# output from a git command that can be translated either contains an +# expected string, or does not contain an unwanted one. 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 |