693
test_cmp expect output
694
'
695
696
+cat > expect << EOF
697
+# On branch master
698
+# Changed but not updated:
699
+# (use "git add <file>..." to update what will be committed)
700
+# (use "git checkout -- <file>..." to discard changes in working directory)
701
+#
702
+# modified: dir1/modified
703
+#
704
+# Untracked files:
705
+# (use "git add <file>..." to include in what will be committed)
706
+#
707
+# dir1/untracked
708
+# dir2/modified
709
+# dir2/untracked
710
+# expect
711
+# output
712
+# untracked
713
+no changes added to commit (use "git add" and/or "git commit -a")
714
+EOF
715
+
716
+test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
717
+ echo modified > sm/untracked &&
718
+ git status --ignore-submodules=untracked > output &&
719
+ test_cmp expect output
720
+'
721
+
722
+test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
723
+ git status --ignore-submodules=dirty > output &&
724
+ test_cmp expect output
725
+'
726
+
727
+test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
728
+ echo modified > sm/foo &&
729
+ git status --ignore-submodules=dirty > output &&
730
+ test_cmp expect output
731
+'
732
+
733
+cat > expect << EOF
734
+# On branch master
735
+# Changed but not updated:
736
+# (use "git add <file>..." to update what will be committed)
737
+# (use "git checkout -- <file>..." to discard changes in working directory)
738
+# (commit or discard the untracked or modified content in submodules)
739
+#
740
+# modified: dir1/modified
741
+# modified: sm (modified content)
742
+#
743
+# Untracked files:
744
+# (use "git add <file>..." to include in what will be committed)
745
+#
746
+# dir1/untracked
747
+# dir2/modified
748
+# dir2/untracked
749
+# expect
750
+# output
751
+# untracked
752
+no changes added to commit (use "git add" and/or "git commit -a")
753
+EOF
754
+
755
+test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
756
+ git status --ignore-submodules=untracked > output &&
757
+ test_cmp expect output
758
+'
759
+
760
+head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
761
+
762
+cat > expect << EOF
763
+# On branch master
764
+# Changed but not updated:
765
+# (use "git add <file>..." to update what will be committed)
766
+# (use "git checkout -- <file>..." to discard changes in working directory)
767
+#
768
+# modified: dir1/modified
769
+# modified: sm (new commits)
770
+#
771
+# Submodules changed but not updated:
772
+#
773
+# * sm $head...$head2 (1):
774
+# > 2nd commit
775
+#
776
+# Untracked files:
777
+# (use "git add <file>..." to include in what will be committed)
778
+#
779
+# dir1/untracked
780
+# dir2/modified
781
+# dir2/untracked
782
+# expect
783
+# output
784
+# untracked
785
+no changes added to commit (use "git add" and/or "git commit -a")
786
+EOF
787
+
788
+test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
789
+ git status --ignore-submodules=untracked > output &&
790
+ test_cmp expect output
791
+'
792
+
793
+test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
794
+ git status --ignore-submodules=dirty > output &&
795
+ test_cmp expect output
796
+'
797
+
798
+cat > expect << EOF
799
+# On branch master
800
+# Changed but not updated:
801
+# (use "git add <file>..." to update what will be committed)
802
+# (use "git checkout -- <file>..." to discard changes in working directory)
803
+#
804
+# modified: dir1/modified
805
+#
806
+# Untracked files:
807
+# (use "git add <file>..." to include in what will be committed)
808
+#
809
+# dir1/untracked
810
+# dir2/modified
811
+# dir2/untracked
812
+# expect
813
+# output
814
+# untracked
815
+no changes added to commit (use "git add" and/or "git commit -a")
816
+EOF
817
+
818
+test_expect_success "--ignore-submodules=all suppresses submodule summary" '
819
+ git status --ignore-submodules=all > output &&
820
+ test_cmp expect output
821
+'
822
+
823
test_done