@@ -808,4 +808,131 @@ test_expect_success POSIXPERM 'status succeeds in a read-only repository' '
808808 (exit $status)
809809'
810810
811+ cat > expect << EOF
812+ # On branch master
813+ # Changed but not updated:
814+ # (use "git add <file>..." to update what will be committed)
815+ # (use "git checkout -- <file>..." to discard changes in working directory)
816+ #
817+ # modified: dir1/modified
818+ #
819+ # Untracked files:
820+ # (use "git add <file>..." to include in what will be committed)
821+ #
822+ # dir1/untracked
823+ # dir2/modified
824+ # dir2/untracked
825+ # expect
826+ # output
827+ # untracked
828+ no changes added to commit (use "git add" and/or "git commit -a")
829+ EOF
830+
831+ test_expect_success ' --ignore-submodules=untracked suppresses submodules with untracked content' '
832+ echo modified > sm/untracked &&
833+ git status --ignore-submodules=untracked > output &&
834+ test_cmp expect output
835+ '
836+
837+ test_expect_success ' --ignore-submodules=dirty suppresses submodules with untracked content' '
838+ git status --ignore-submodules=dirty > output &&
839+ test_cmp expect output
840+ '
841+
842+ test_expect_success ' --ignore-submodules=dirty suppresses submodules with modified content' '
843+ echo modified > sm/foo &&
844+ git status --ignore-submodules=dirty > output &&
845+ test_cmp expect output
846+ '
847+
848+ cat > expect << EOF
849+ # On branch master
850+ # Changed but not updated:
851+ # (use "git add <file>..." to update what will be committed)
852+ # (use "git checkout -- <file>..." to discard changes in working directory)
853+ # (commit or discard the untracked or modified content in submodules)
854+ #
855+ # modified: dir1/modified
856+ # modified: sm (modified content)
857+ #
858+ # Untracked files:
859+ # (use "git add <file>..." to include in what will be committed)
860+ #
861+ # dir1/untracked
862+ # dir2/modified
863+ # dir2/untracked
864+ # expect
865+ # output
866+ # untracked
867+ no changes added to commit (use "git add" and/or "git commit -a")
868+ EOF
869+
870+ test_expect_success " --ignore-submodules=untracked doesn't suppress submodules with modified content" '
871+ git status --ignore-submodules=untracked > output &&
872+ test_cmp expect output
873+ '
874+
875+ head2=$( cd sm && git commit -q -m " 2nd commit" foo && git rev-parse --short=7 --verify HEAD)
876+
877+ cat > expect << EOF
878+ # On branch master
879+ # Changed but not updated:
880+ # (use "git add <file>..." to update what will be committed)
881+ # (use "git checkout -- <file>..." to discard changes in working directory)
882+ #
883+ # modified: dir1/modified
884+ # modified: sm (new commits)
885+ #
886+ # Submodules changed but not updated:
887+ #
888+ # * sm $head ...$head2 (1):
889+ # > 2nd commit
890+ #
891+ # Untracked files:
892+ # (use "git add <file>..." to include in what will be committed)
893+ #
894+ # dir1/untracked
895+ # dir2/modified
896+ # dir2/untracked
897+ # expect
898+ # output
899+ # untracked
900+ no changes added to commit (use "git add" and/or "git commit -a")
901+ EOF
902+
903+ test_expect_success " --ignore-submodules=untracked doesn't suppress submodule summary" '
904+ git status --ignore-submodules=untracked > output &&
905+ test_cmp expect output
906+ '
907+
908+ test_expect_success " --ignore-submodules=dirty doesn't suppress submodule summary" '
909+ git status --ignore-submodules=dirty > output &&
910+ test_cmp expect output
911+ '
912+
913+ cat > expect << EOF
914+ # On branch master
915+ # Changed but not updated:
916+ # (use "git add <file>..." to update what will be committed)
917+ # (use "git checkout -- <file>..." to discard changes in working directory)
918+ #
919+ # modified: dir1/modified
920+ #
921+ # Untracked files:
922+ # (use "git add <file>..." to include in what will be committed)
923+ #
924+ # dir1/untracked
925+ # dir2/modified
926+ # dir2/untracked
927+ # expect
928+ # output
929+ # untracked
930+ no changes added to commit (use "git add" and/or "git commit -a")
931+ EOF
932+
933+ test_expect_success " --ignore-submodules=all suppresses submodule summary" '
934+ git status --ignore-submodules=all > output &&
935+ test_cmp expect output
936+ '
937+
811938test_done
0 commit comments