X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft7508-status.sh;h=905255adf0ca5b15d9befa772cda4a650bd15f34;hb=588150b0231ee342ed528292a2205f4049b3dcb1;hp=cd6e2c5e871230a43f504e165498139d8ec7a3d2;hpb=79531569397d88336c147e620fddb1cbf9612d49;p=git.git diff --git a/t/t7508-status.sh b/t/t7508-status.sh index cd6e2c5e8..905255adf 100755 --- a/t/t7508-status.sh +++ b/t/t7508-status.sh @@ -131,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_cmp 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_cmp expect output +' + +rm -f .gitignore + cat >expect <<\EOF ## master M dir1/modified @@ -780,6 +901,13 @@ test_expect_success 'status -s submodule summary (clean submodule)' ' test_cmp expect output ' +test_expect_success 'status -z implies porcelain' ' + git status --porcelain | + perl -pe "s/\012/\000/g" >expect && + git status -z >output && + test_cmp expect output +' + cat >expect <