diff options
Diffstat (limited to 't/t7508-status.sh')
-rwxr-xr-x | t/t7508-status.sh | 115 |
1 files changed, 65 insertions, 50 deletions
diff --git a/t/t7508-status.sh b/t/t7508-status.sh index f1dc5c3b6a..a93e70fac4 100755 --- a/t/t7508-status.sh +++ b/t/t7508-status.sh @@ -55,7 +55,7 @@ test_expect_success 'setup' ' git add dir2/added ' -test_expect_success 'status (1)' ' +test_expect_success C_LOCALE_OUTPUT 'status (1)' ' grep "use \"git rm --cached <file>\.\.\.\" to unstage" output @@ -85,7 +85,7 @@ cat >expect <<\EOF # untracked EOF -test_expect_success 'status (2)' ' +test_expect_success C_LOCALE_OUTPUT 'status (2)' ' git status >output && test_cmp expect output @@ -111,7 +111,7 @@ EOF git config advice.statusHints false -test_expect_success 'status (advice.statusHints false)' ' +test_expect_success C_LOCALE_OUTPUT 'status (advice.statusHints false)' ' git status >output && test_cmp expect output @@ -157,6 +157,12 @@ test_expect_success 'status -s -b' ' ' +test_expect_success 'setup dir3' ' + mkdir dir3 && + : >dir3/untracked1 && + : >dir3/untracked2 +' + cat >expect <<EOF # On branch master # Changes to be committed: @@ -172,16 +178,14 @@ cat >expect <<EOF # # Untracked files not listed (use -u option to show untracked files) EOF -test_expect_success 'status -uno' ' - mkdir dir3 && - : >dir3/untracked1 && - : >dir3/untracked2 && +test_expect_success C_LOCALE_OUTPUT 'status -uno' ' git status -uno >output && test_cmp expect output ' -test_expect_success 'status (status.showUntrackedFiles no)' ' +test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles no)' ' git config status.showuntrackedfiles no + test_when_finished "git config --unset status.showuntrackedfiles" && git status >output && test_cmp expect output ' @@ -197,7 +201,7 @@ cat >expect <<EOF # Untracked files not listed EOF git config advice.statusHints false -test_expect_success 'status -uno (advice.statusHints false)' ' +test_expect_success C_LOCALE_OUTPUT 'status -uno (advice.statusHints false)' ' git status -uno >output && test_cmp expect output ' @@ -208,7 +212,6 @@ cat >expect << EOF A dir2/added EOF test_expect_success 'status -s -uno' ' - git config --unset status.showuntrackedfiles git status -s -uno >output && test_cmp expect output ' @@ -243,13 +246,14 @@ cat >expect <<EOF # output # untracked EOF -test_expect_success 'status -unormal' ' +test_expect_success C_LOCALE_OUTPUT 'status -unormal' ' git status -unormal >output && test_cmp expect output ' -test_expect_success 'status (status.showUntrackedFiles normal)' ' +test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles normal)' ' git config status.showuntrackedfiles normal + test_when_finished "git config --unset status.showuntrackedfiles" && git status >output && test_cmp expect output ' @@ -266,7 +270,6 @@ A dir2/added ?? untracked EOF test_expect_success 'status -s -unormal' ' - git config --unset status.showuntrackedfiles git status -s -unormal >output && test_cmp expect output ' @@ -302,18 +305,21 @@ cat >expect <<EOF # output # untracked EOF -test_expect_success 'status -uall' ' +test_expect_success C_LOCALE_OUTPUT 'status -uall' ' git status -uall >output && test_cmp expect output ' -test_expect_success 'status (status.showUntrackedFiles all)' ' +test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles all)' ' git config status.showuntrackedfiles all + test_when_finished "git config --unset status.showuntrackedfiles" && git status >output && - rm -rf dir3 && - git config --unset status.showuntrackedfiles && test_cmp expect output ' +test_expect_success 'teardown dir3' ' + rm -rf dir3 +' + cat >expect <<EOF M dir1/modified A dir2/added @@ -361,7 +367,7 @@ cat >expect <<\EOF # ../untracked EOF -test_expect_success 'status with relative paths' ' +test_expect_success C_LOCALE_OUTPUT 'status with relative paths' ' (cd dir1 && git status) >output && test_cmp expect output @@ -434,18 +440,19 @@ cat >expect <<\EOF # <BLUE>untracked<RESET> EOF -test_expect_success 'status with color.ui' ' +test_expect_success C_LOCALE_OUTPUT '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_expect_success 'status with color.status' ' +test_expect_success C_LOCALE_OUTPUT 'status with color.status' ' - git config --unset color.ui && git config color.status always && + test_when_finished "git config --unset color.status" && git status | test_decode_color >output && test_cmp expect output @@ -464,7 +471,6 @@ EOF test_expect_success 'status -s with color.ui' ' - git config --unset color.status && git config color.ui always && git status -s | test_decode_color >output && test_cmp expect output @@ -564,9 +570,10 @@ cat >expect <<\EOF EOF -test_expect_success 'status without relative paths' ' +test_expect_success C_LOCALE_OUTPUT 'status without relative paths' ' - git config status.relativePaths false + git config status.relativePaths false && + test_when_finished "git config --unset status.relativePaths" && (cd dir1 && git status) >output && test_cmp expect output @@ -585,6 +592,8 @@ EOF test_expect_success 'status -s without relative paths' ' + git config status.relativePaths false && + test_when_finished "git config --unset status.relativePaths" && (cd dir1 && git status -s) >output && test_cmp expect output @@ -607,7 +616,10 @@ 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 && + 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 ' @@ -655,13 +667,13 @@ cat >expect <<EOF # output # untracked EOF -test_expect_success 'status submodule summary is disabled by default' ' +test_expect_success C_LOCALE_OUTPUT 'status submodule summary is disabled by default' ' git status >output && test_cmp expect output ' # we expect the same as the previous test -test_expect_success 'status --untracked-files=all does not show submodule' ' +test_expect_success C_LOCALE_OUTPUT 'status --untracked-files=all does not show submodule' ' git status --untracked-files=all >output && test_cmp expect output ' @@ -719,7 +731,7 @@ cat >expect <<EOF # output # untracked EOF -test_expect_success 'status submodule summary' ' +test_expect_success C_LOCALE_OUTPUT 'status submodule summary' ' git config status.submodulesummary 10 && git status >output && test_cmp expect output @@ -760,8 +772,11 @@ cat >expect <<EOF # untracked no changes added to commit (use "git add" and/or "git commit -a") EOF -test_expect_success 'status submodule summary (clean submodule)' ' - git commit -m "commit submodule" && +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 config status.submodulesummary 10 && test_must_fail git commit --dry-run >output && test_cmp expect output && @@ -812,7 +827,7 @@ cat >expect <<EOF # output # untracked EOF -test_expect_success 'commit --dry-run submodule summary (--amend)' ' +test_expect_success C_LOCALE_OUTPUT 'commit --dry-run submodule summary (--amend)' ' git config status.submodulesummary 10 && git commit --dry-run --amend >output && test_cmp expect output @@ -867,13 +882,13 @@ cat > expect << EOF # untracked EOF -test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' ' +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 '.gitmodules ignore=untracked suppresses submodules with untracked content' ' +test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=untracked suppresses submodules with untracked content' ' git config diff.ignoreSubmodules dirty && git status >output && test_cmp expect output && @@ -885,7 +900,7 @@ test_expect_success '.gitmodules ignore=untracked suppresses submodules with unt git config --unset diff.ignoreSubmodules ' -test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' ' +test_expect_success C_LOCALE_OUTPUT '.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 && @@ -896,12 +911,12 @@ test_expect_success '.git/config ignore=untracked suppresses submodules with unt git config --remove-section -f .gitmodules submodule.subname ' -test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' ' +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 '.gitmodules ignore=dirty suppresses submodules with untracked content' ' +test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with untracked content' ' git config diff.ignoreSubmodules dirty && git status >output && ! test -s actual && @@ -913,7 +928,7 @@ test_expect_success '.gitmodules ignore=dirty suppresses submodules with untrack git config --unset diff.ignoreSubmodules ' -test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' ' +test_expect_success C_LOCALE_OUTPUT '.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 && @@ -924,13 +939,13 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with untrack git config -f .gitmodules --remove-section submodule.subname ' -test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' ' +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 '.gitmodules ignore=dirty suppresses submodules with modified content' ' +test_expect_success C_LOCALE_OUTPUT '.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 && @@ -938,7 +953,7 @@ test_expect_success '.gitmodules ignore=dirty suppresses submodules with modifie git config -f .gitmodules --remove-section submodule.subname ' -test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' ' +test_expect_success C_LOCALE_OUTPUT '.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 && @@ -981,12 +996,12 @@ cat > expect << EOF # untracked EOF -test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" ' +test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodules with modified content" ' git status --ignore-submodules=untracked > output && test_cmp expect output ' -test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" ' +test_expect_success C_LOCALE_OUTPUT ".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 && @@ -994,7 +1009,7 @@ test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules wi git config -f .gitmodules --remove-section submodule.subname ' -test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" ' +test_expect_success C_LOCALE_OUTPUT ".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 && @@ -1043,12 +1058,12 @@ cat > expect << EOF # untracked EOF -test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" ' +test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodule summary" ' git status --ignore-submodules=untracked > output && test_cmp expect output ' -test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" ' +test_expect_success C_LOCALE_OUTPUT ".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 && @@ -1056,7 +1071,7 @@ test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule sum git config -f .gitmodules --remove-section submodule.subname ' -test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" ' +test_expect_success C_LOCALE_OUTPUT ".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 && @@ -1067,11 +1082,11 @@ test_expect_success ".git/config ignore=untracked doesn't suppress submodule sum git config -f .gitmodules --remove-section submodule.subname ' -test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" ' +test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=dirty doesn't suppress submodule summary" ' git status --ignore-submodules=dirty > output && test_cmp expect output ' -test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" ' +test_expect_success C_LOCALE_OUTPUT ".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 && @@ -1079,7 +1094,7 @@ test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary git config -f .gitmodules --remove-section submodule.subname ' -test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" ' +test_expect_success C_LOCALE_OUTPUT ".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 && @@ -1111,7 +1126,7 @@ cat > expect << EOF no changes added to commit (use "git add" and/or "git commit -a") EOF -test_expect_success "--ignore-submodules=all suppresses submodule summary" ' +test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=all suppresses submodule summary" ' git status --ignore-submodules=all > output && test_cmp expect output ' |