808
(exit $status)
809
'
810
811
+(cd sm && echo > bar && git add bar && git commit -q -m 'Add bar' && cd .. && git add sm)
812
+new_head=$(cd sm && git rev-parse --short=7 --verify HEAD)
813
+touch .gitmodules
814
+
815
cat > expect << EOF
816
# On branch master
817
+# Changes to be committed:
818
+# (use "git reset HEAD <file>..." to unstage)
819
+#
820
+# modified: sm
821
+#
822
# Changed but not updated:
823
# (use "git add <file>..." to update what will be committed)
824
# (use "git checkout -- <file>..." to discard changes in working directory)
825
#
826
# modified: dir1/modified
827
#
828
+# Submodule changes to be committed:
829
+#
830
+# * sm $head...$new_head (1):
831
+# > Add bar
832
+#
833
# Untracked files:
834
# (use "git add <file>..." to include in what will be committed)
835
#
836
+# .gitmodules
837
# dir1/untracked
838
# dir2/modified
839
# dir2/untracked
840
# expect
841
# output
842
# untracked
828
-no changes added to commit (use "git add" and/or "git commit -a")
843
EOF
844
845
test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
848
test_cmp expect output
849
'
850
851
+test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
852
+ git config --add submodule.subname.ignore untracked &&
853
+ git config --add submodule.subname.path sm &&
854
+ git status > output &&
855
+ test_cmp expect output &&
856
+ git config --remove-section submodule.subname
857
+'
858
+
859
test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
860
git status --ignore-submodules=dirty > output &&
861
test_cmp expect output
862
'
863
864
+test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
865
+ git config --add submodule.subname.ignore dirty &&
866
+ git config --add submodule.subname.path sm &&
867
+ git status > output &&
868
+ test_cmp expect output &&
869
+ git config --remove-section submodule.subname
870
+'
871
+
872
test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
873
echo modified > sm/foo &&
874
git status --ignore-submodules=dirty > output &&
875
test_cmp expect output
876
'
877
878
+test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
879
+ git config --add submodule.subname.ignore dirty &&
880
+ git config --add submodule.subname.path sm &&
881
+ git status > output &&
882
+ test_cmp expect output &&
883
+ git config --remove-section submodule.subname
884
+'
885
+
886
cat > expect << EOF
887
# On branch master
888
+# Changes to be committed:
889
+# (use "git reset HEAD <file>..." to unstage)
890
+#
891
+# modified: sm
892
+#
893
# Changed but not updated:
894
# (use "git add <file>..." to update what will be committed)
895
# (use "git checkout -- <file>..." to discard changes in working directory)
898
# modified: dir1/modified
899
# modified: sm (modified content)
900
#
901
+# Submodule changes to be committed:
902
+#
903
+# * sm $head...$new_head (1):
904
+# > Add bar
905
+#
906
# Untracked files:
907
# (use "git add <file>..." to include in what will be committed)
908
#
909
+# .gitmodules
910
# dir1/untracked
911
# dir2/modified
912
# dir2/untracked
913
# expect
914
# output
915
# untracked
867
-no changes added to commit (use "git add" and/or "git commit -a")
916
EOF
917
918
test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
920
test_cmp expect output
921
'
922
923
+test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
924
+ git config --add submodule.subname.ignore untracked &&
925
+ git config --add submodule.subname.path sm &&
926
+ git status > output &&
927
+ test_cmp expect output &&
928
+ git config --remove-section submodule.subname
929
+'
930
+
931
head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 --verify HEAD)
932
933
cat > expect << EOF
934
# On branch master
935
+# Changes to be committed:
936
+# (use "git reset HEAD <file>..." to unstage)
937
+#
938
+# modified: sm
939
+#
940
# Changed but not updated:
941
# (use "git add <file>..." to update what will be committed)
942
# (use "git checkout -- <file>..." to discard changes in working directory)
944
# modified: dir1/modified
945
# modified: sm (new commits)
946
#
947
+# Submodule changes to be committed:
948
+#
949
+# * sm $head...$new_head (1):
950
+# > Add bar
951
+#
952
# Submodules changed but not updated:
953
#
888
-# * sm $head...$head2 (1):
954
+# * sm $new_head...$head2 (1):
955
# > 2nd commit
956
#
957
# Untracked files:
958
# (use "git add <file>..." to include in what will be committed)
959
#
960
+# .gitmodules
961
# dir1/untracked
962
# dir2/modified
963
# dir2/untracked
964
# expect
965
# output
966
# untracked
900
-no changes added to commit (use "git add" and/or "git commit -a")
967
EOF
968
969
test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
971
test_cmp expect output
972
'
973
974
+test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
975
+ git config --add submodule.subname.ignore untracked &&
976
+ git config --add submodule.subname.path sm &&
977
+ git status > output &&
978
+ test_cmp expect output &&
979
+ git config --remove-section submodule.subname
980
+'
981
+
982
test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
983
git status --ignore-submodules=dirty > output &&
984
test_cmp expect output
985
'
986
987
+test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
988
+ git config --add submodule.subname.ignore dirty &&
989
+ git config --add submodule.subname.path sm &&
990
+ git status > output &&
991
+ test_cmp expect output &&
992
+ git config --remove-section submodule.subname
993
+'
994
+
995
+
996
cat > expect << EOF
997
# On branch master
998
# Changed but not updated:
1004
# Untracked files:
1005
# (use "git add <file>..." to include in what will be committed)
1006
#
1007
+# .gitmodules
1008
# dir1/untracked
1009
# dir2/modified
1010
# dir2/untracked
1019
test_cmp expect output
1020
'
1021
1022
+test_expect_failure '.git/config ignore=all suppresses submodule summary' '
1023
+ git config --add submodule.subname.ignore all &&
1024
+ git config --add submodule.subname.path sm &&
1025
+ git status > output &&
1026
+ test_cmp expect output &&
1027
+ git config --remove-section submodule.subname
1028
+'
1029
+
1030
test_done