X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft7508-status.sh;h=fc57b135c50e34ab86c04d0a0ec81052ce40f8ff;hb=113e828d3893f31ef72dd8287e95da9fa2287110;hp=f1dc5c3b6a36507e664e624bf9cebb1634bce335;hpb=ed36a48e6d246f4f60d44b27e8c1e660151cd0b4;p=git.git diff --git a/t/t7508-status.sh b/t/t7508-status.sh index f1dc5c3b6..fc57b135c 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' ' @@ -56,9 +56,7 @@ test_expect_success 'setup' ' ' test_expect_success 'status (1)' ' - - grep "use \"git rm --cached \.\.\.\" to unstage" output - + test_i18ngrep "use \"git rm --cached \.\.\.\" to unstage" output ' cat >expect <<\EOF @@ -86,10 +84,8 @@ cat >expect <<\EOF EOF 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 '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 @@ -138,6 +131,127 @@ test_expect_success 'status -s' ' ' +test_expect_success 'status with gitignore' ' + { + echo ".gitignore" && + echo "expect" && + echo "output" && + echo "untracked" + } >.gitignore && + + cat >expect <<-\EOF && + M dir1/modified + A dir2/added + ?? dir2/modified + EOF + git status -s >output && + test_cmp expect output && + + cat >expect <<-\EOF && + M dir1/modified + A dir2/added + ?? dir2/modified + !! .gitignore + !! dir1/untracked + !! dir2/untracked + !! expect + !! output + !! untracked + EOF + git status -s --ignored >output && + test_cmp expect output && + + cat >expect <<-\EOF && + # On branch master + # Changes to be committed: + # (use "git reset HEAD ..." to unstage) + # + # new file: dir2/added + # + # Changes not staged for commit: + # (use "git add ..." to update what will be committed) + # (use "git checkout -- ..." to discard changes in working directory) + # + # modified: dir1/modified + # + # Untracked files: + # (use "git add ..." to include in what will be committed) + # + # dir2/modified + # Ignored files: + # (use "git add -f ..." to include in what will be committed) + # + # .gitignore + # dir1/untracked + # dir2/untracked + # expect + # output + # untracked + EOF + git status --ignored >output && + test_i18ncmp expect output +' + +test_expect_success 'status with gitignore (nothing untracked)' ' + { + echo ".gitignore" && + echo "expect" && + echo "dir2/modified" && + echo "output" && + echo "untracked" + } >.gitignore && + + cat >expect <<-\EOF && + M dir1/modified + A dir2/added + EOF + git status -s >output && + test_cmp expect output && + + cat >expect <<-\EOF && + M dir1/modified + A dir2/added + !! .gitignore + !! dir1/untracked + !! dir2/modified + !! dir2/untracked + !! expect + !! output + !! untracked + EOF + git status -s --ignored >output && + test_cmp expect output && + + cat >expect <<-\EOF && + # On branch master + # Changes to be committed: + # (use "git reset HEAD ..." to unstage) + # + # new file: dir2/added + # + # Changes not staged for commit: + # (use "git add ..." to update what will be committed) + # (use "git checkout -- ..." to discard changes in working directory) + # + # modified: dir1/modified + # + # Ignored files: + # (use "git add -f ..." to include in what will be committed) + # + # .gitignore + # dir1/untracked + # dir2/modified + # dir2/untracked + # expect + # output + # untracked + EOF + git status --ignored >output && + test_i18ncmp expect output +' + +rm -f .gitignore + cat >expect <<\EOF ## master M dir1/modified @@ -157,6 +271,12 @@ test_expect_success 'status -s -b' ' ' +test_expect_success 'setup dir3' ' + mkdir dir3 && + : >dir3/untracked1 && + : >dir3/untracked2 +' + cat >expect <expect <dir3/untracked1 && - : >dir3/untracked2 && git status -uno >output && - test_cmp expect output + test_i18ncmp expect output ' 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 <output && - test_cmp expect output + test_i18ncmp expect output ' git config --unset advice.statusHints @@ -208,7 +326,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 ' @@ -245,13 +362,14 @@ cat >expect <output && - test_cmp expect output + test_i18ncmp expect output ' 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 <output && test_cmp expect output ' @@ -304,14 +421,18 @@ cat >expect <output && - test_cmp expect output + test_i18ncmp expect output ' + test_expect_success '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_i18ncmp expect output +' + +test_expect_success 'teardown dir3' ' + rm -rf dir3 ' cat >expect <expect <<\EOF EOF test_expect_success 'status with relative paths' ' - (cd dir1 && git status) >output && - test_cmp expect output - + test_i18ncmp expect output ' cat >expect <<\EOF @@ -435,20 +554,17 @@ cat >expect <<\EOF EOF 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 '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 - + test_i18ncmp expect output ' cat >expect <<\EOF @@ -464,7 +580,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 @@ -566,9 +681,10 @@ EOF test_expect_success '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 + test_i18ncmp expect output ' @@ -585,6 +701,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 @@ -608,7 +726,7 @@ cat <expect EOF test_expect_success 'dry-run of partial commit excluding new file in index' ' git commit --dry-run dir1/modified >output && - test_cmp expect output + test_i18ncmp expect output ' cat >expect <expect <output && - test_cmp expect output + test_i18ncmp expect output ' # we expect the same as the previous test 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 <output && - test_cmp expect output + test_i18ncmp expect output ' cat >expect <expect <output && - test_cmp expect output && + test_i18ncmp expect output && git status >output && - test_cmp expect output + test_i18ncmp expect output ' cat >expect <expect && + git status -z >output && + test_cmp expect output +' + cat >expect <output && - test_cmp expect output + test_i18ncmp expect output ' test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' ' @@ -868,19 +993,19 @@ cat > expect << EOF EOF test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' ' - echo modified > sm/untracked && - git status --ignore-submodules=untracked > output && - test_cmp expect output + echo modified sm/untracked && + git status --ignore-submodules=untracked >output && + test_i18ncmp expect output ' 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 ' @@ -890,15 +1015,15 @@ test_expect_success '.git/config ignore=untracked suppresses submodules with unt 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 '--ignore-submodules=dirty suppresses submodules with untracked content' ' - git status --ignore-submodules=dirty > output && - test_cmp expect output + git status --ignore-submodules=dirty >output && + test_i18ncmp expect output ' test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' ' @@ -907,8 +1032,8 @@ test_expect_success '.gitmodules ignore=dirty suppresses submodules with untrack ! 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 ' @@ -918,23 +1043,23 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with untrack 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 '--ignore-submodules=dirty suppresses submodules with modified content' ' - echo modified > sm/foo && - git status --ignore-submodules=dirty > output && - test_cmp expect output + echo modified >sm/foo && + git status --ignore-submodules=dirty >output && + test_i18ncmp expect output ' 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 ' @@ -943,8 +1068,8 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with modifie 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 ' @@ -983,14 +1108,14 @@ EOF 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 ".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 ' @@ -999,8 +1124,8 @@ test_expect_success ".git/config ignore=untracked doesn't suppress submodules wi 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 ' @@ -1045,14 +1170,14 @@ EOF 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 ".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 ' @@ -1061,21 +1186,21 @@ test_expect_success ".git/config ignore=untracked doesn't suppress submodule sum 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 "--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 ".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 ' @@ -1084,8 +1209,8 @@ test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary 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 ' @@ -1113,7 +1238,7 @@ EOF 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' '