@matheusbsbs / matheus-bagliano / commits / aee9c7d654
Fork 0

Submodules: Add the new "ignore" config option for diff and status

The new "ignore" config option controls the default behavior for "git status" and the diff family. It specifies under what circumstances they consider submodules as modified and can be set separately for each submodule. The command line option "--ignore-submodules=" has been extended to accept the new parameter "none" for both status and diff. Users that chose submodules to get rid of long work tree scanning times might want to set the "dirty" option for those submodules. This brings back the pre 1.7.0 behavior, where submodule work trees were never scanned for modifications. By using "--ignore-submodules=none" on the command line the status and diff commands can be told to do a full scan. This option can be set to the following values (which have the same name and meaning as for the "--ignore-submodules" option of status and diff): "all": All changes to the submodule will be ignored. "dirty": Only differences of the commit recorded in the superproject and the submodules HEAD will be considered modifications, all changes to the work tree of the submodule will be ignored. When using this value, the submodule will not be scanned for work tree changes at all, leading to a performance benefit on large submodules. "untracked": Only untracked files in the submodules work tree are ignored, a changed HEAD and/or modified files in the submodule will mark it as modified. "none" (which is the default): Either untracked or modified files in a submodules work tree or a difference between the subdmodules HEAD and the commit recorded in the superproject will make it show up as changed. This value is added as a new parameter for the "--ignore-submodules" option of the diff family and "git status" so the user can override the settings in the configuration. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jens Lehmann committed Aug 6, 2010 at 00:39 UTC aee9c7d6540fe6f66fbbe7be420caa26ae0fa2d9
11 files changed +297 -20
Documentation/config.txt
+10
@@ -1743,6 +1743,16 @@ submodule.<name>.update::
1743 URL and other values found in the `.gitmodules` file. See
1744 linkgit:git-submodule[1] and linkgit:gitmodules[5] for details.
1745
1746 +submodule.<name>.ignore::
1747 + Defines under what circumstances "git status" and the diff family show
1748 + a submodule as modified. When set to "all", it will never be considered
1749 + modified, "dirty" will ignore all changes to the submodules work tree and
1750 + takes only differences between the HEAD of the submodule and the commit
1751 + recorded in the superproject into account. "untracked" will additionally
1752 + let submodules with modified tracked files in their work tree show up.
1753 + Using "none" (the default when this option is not set) also shows
1754 + submodules that have untracked files in their work tree as changed.
1755 +
1756 tar.umask::
1757 This variable can be used to restrict the permission bits of
1758 tar archive entries. The default is 0002, which turns off the
Documentation/diff-options.txt
+5 -1
@@ -330,7 +330,11 @@ endif::git-format-patch[]
330
331 --ignore-submodules[=<when>]::
332 Ignore changes to submodules in the diff generation. <when> can be
333 - either "untracked", "dirty" or "all", which is the default. When
333 + either "none", "untracked", "dirty" or "all", which is the default
334 + Using "none" will consider the submodule modified when it either contains
335 + untracked or modified files or its HEAD differs from the commit recorded
336 + in the superproject and can be used to override any settings of the
337 + 'ignore' option in linkgit:git-config[1]. When
338 "untracked" is used submodules are not considered dirty when they only
339 contain untracked content (but they are still scanned for modified
340 content). Using "dirty" ignores all changes to the work tree of submodules,
Documentation/git-status.txt
+5 -1
@@ -55,7 +55,11 @@ specified.
55
56 --ignore-submodules[=<when>]::
57 Ignore changes to submodules when looking for changes. <when> can be
58 - either "untracked", "dirty" or "all", which is the default. When
58 + either "none", "untracked", "dirty" or "all", which is the default.
59 + Using "none" will consider the submodule modified when it either contains
60 + untracked or modified files or its HEAD differs from the commit recorded
61 + in the superproject and can be used to override any settings of the
62 + 'ignore' option in linkgit:git-config[1]. When
63 "untracked" is used submodules are not considered dirty when they only
64 contain untracked content (but they are still scanned for modified
65 content). Using "dirty" ignores all changes to the work tree of submodules,
diff-lib.c
+10 -5
@@ -68,11 +68,16 @@ static int match_stat_with_submodule(struct diff_options *diffopt,
68 unsigned ce_option, unsigned *dirty_submodule)
69 {
70 int changed = ce_match_stat(ce, st, ce_option);
71 - if (S_ISGITLINK(ce->ce_mode)
72 - && !DIFF_OPT_TST(diffopt, IGNORE_SUBMODULES)
73 - && !DIFF_OPT_TST(diffopt, IGNORE_DIRTY_SUBMODULES)
74 - && (!changed || DIFF_OPT_TST(diffopt, DIRTY_SUBMODULES))) {
75 - *dirty_submodule = is_submodule_modified(ce->name, DIFF_OPT_TST(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES));
71 + if (S_ISGITLINK(ce->ce_mode)) {
72 + unsigned orig_flags = diffopt->flags;
73 + if (!DIFF_OPT_TST(diffopt, OVERRIDE_SUBMODULE_CONFIG))
74 + set_diffopt_flags_from_submodule_config(diffopt, ce->name);
75 + if (DIFF_OPT_TST(diffopt, IGNORE_SUBMODULES))
76 + changed = 0;
77 + else if (!DIFF_OPT_TST(diffopt, IGNORE_DIRTY_SUBMODULES)
78 + && (!changed || DIFF_OPT_TST(diffopt, DIRTY_SUBMODULES)))
79 + *dirty_submodule = is_submodule_modified(ce->name, DIFF_OPT_TST(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES));
80 + diffopt->flags = orig_flags;
81 }
82 return changed;
83 }
diff.c
+29 -6
@@ -141,6 +141,9 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)
141 return 0;
142 }
143
144 + if (!prefixcmp(var, "submodule."))
145 + return parse_submodule_config_option(var, value);
146 +
147 return git_color_default_config(var, value, cb);
148 }
149
@@ -3166,11 +3169,13 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
3169 DIFF_OPT_SET(options, ALLOW_TEXTCONV);
3170 else if (!strcmp(arg, "--no-textconv"))
3171 DIFF_OPT_CLR(options, ALLOW_TEXTCONV);
3169 - else if (!strcmp(arg, "--ignore-submodules"))
3172 + else if (!strcmp(arg, "--ignore-submodules")) {
3173 + DIFF_OPT_SET(options, OVERRIDE_SUBMODULE_CONFIG);
3174 handle_ignore_submodules_arg(options, "all");
3171 - else if (!prefixcmp(arg, "--ignore-submodules="))
3175 + } else if (!prefixcmp(arg, "--ignore-submodules=")) {
3176 + DIFF_OPT_SET(options, OVERRIDE_SUBMODULE_CONFIG);
3177 handle_ignore_submodules_arg(options, arg + 20);
3173 - else if (!strcmp(arg, "--submodule"))
3178 + } else if (!strcmp(arg, "--submodule"))
3179 DIFF_OPT_SET(options, SUBMODULE_LOG);
3180 else if (!prefixcmp(arg, "--submodule=")) {
3181 if (!strcmp(arg + 12, "log"))
@@ -4103,6 +4108,24 @@ int diff_result_code(struct diff_options *opt, int status)
4108 return result;
4109 }
4110
4111 +/*
4112 + * Shall changes to this submodule be ignored?
4113 + *
4114 + * Submodule changes can be configured to be ignored separately for each path,
4115 + * but that configuration can be overridden from the command line.
4116 + */
4117 +static int is_submodule_ignored(const char *path, struct diff_options *options)
4118 +{
4119 + int ignored = 0;
4120 + unsigned orig_flags = options->flags;
4121 + if (!DIFF_OPT_TST(options, OVERRIDE_SUBMODULE_CONFIG))
4122 + set_diffopt_flags_from_submodule_config(options, path);
4123 + if (DIFF_OPT_TST(options, IGNORE_SUBMODULES))
4124 + ignored = 1;
4125 + options->flags = orig_flags;
4126 + return ignored;
4127 +}
4128 +
4129 void diff_addremove(struct diff_options *options,
4130 int addremove, unsigned mode,
4131 const unsigned char *sha1,
@@ -4110,7 +4133,7 @@ void diff_addremove(struct diff_options *options,
4133 {
4134 struct diff_filespec *one, *two;
4135
4113 - if (DIFF_OPT_TST(options, IGNORE_SUBMODULES) && S_ISGITLINK(mode))
4136 + if (S_ISGITLINK(mode) && is_submodule_ignored(concatpath, options))
4137 return;
4138
4139 /* This may look odd, but it is a preparation for
@@ -4157,8 +4180,8 @@ void diff_change(struct diff_options *options,
4180 {
4181 struct diff_filespec *one, *two;
4182
4160 - if (DIFF_OPT_TST(options, IGNORE_SUBMODULES) && S_ISGITLINK(old_mode)
4161 - && S_ISGITLINK(new_mode))
4183 + if (S_ISGITLINK(old_mode) && S_ISGITLINK(new_mode) &&
4184 + is_submodule_ignored(concatpath, options))
4185 return;
4186
4187 if (DIFF_OPT_TST(options, REVERSE_DIFF)) {
diff.h
+1
@@ -77,6 +77,7 @@ typedef struct strbuf *(*diff_prefix_fn_t)(struct diff_options *opt, void *data)
77 #define DIFF_OPT_DIRTY_SUBMODULES (1 << 24)
78 #define DIFF_OPT_IGNORE_UNTRACKED_IN_SUBMODULES (1 << 25)
79 #define DIFF_OPT_IGNORE_DIRTY_SUBMODULES (1 << 26)
80 +#define DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG (1 << 27)
81
82 #define DIFF_OPT_TST(opts, flag) ((opts)->flags & DIFF_OPT_##flag)
83 #define DIFF_OPT_SET(opts, flag) ((opts)->flags |= DIFF_OPT_##flag)
submodule.c
+56 -1
@@ -6,6 +6,10 @@
6 #include "revision.h"
7 #include "run-command.h"
8 #include "diffcore.h"
9 +#include "string-list.h"
10 +
11 +struct string_list config_name_for_path;
12 +struct string_list config_ignore_for_name;
13
14 static int add_submodule_odb(const char *path)
15 {
@@ -46,6 +50,57 @@ done:
50 return ret;
51 }
52
53 +void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
54 + const char *path)
55 +{
56 + struct string_list_item *path_option, *ignore_option;
57 + path_option = unsorted_string_list_lookup(&config_name_for_path, path);
58 + if (path_option) {
59 + ignore_option = unsorted_string_list_lookup(&config_ignore_for_name, path_option->util);
60 + if (ignore_option)
61 + handle_ignore_submodules_arg(diffopt, ignore_option->util);
62 + }
63 +}
64 +
65 +int parse_submodule_config_option(const char *var, const char *value)
66 +{
67 + int len;
68 + struct string_list_item *config;
69 + struct strbuf submodname = STRBUF_INIT;
70 +
71 + var += 10; /* Skip "submodule." */
72 +
73 + len = strlen(var);
74 + if ((len > 5) && !strcmp(var + len - 5, ".path")) {
75 + strbuf_add(&submodname, var, len - 5);
76 + config = unsorted_string_list_lookup(&config_name_for_path, value);
77 + if (config)
78 + free(config->util);
79 + else
80 + config = string_list_append(&config_name_for_path, xstrdup(value));
81 + config->util = strbuf_detach(&submodname, NULL);
82 + strbuf_release(&submodname);
83 + } else if ((len > 7) && !strcmp(var + len - 7, ".ignore")) {
84 + if (strcmp(value, "untracked") && strcmp(value, "dirty") &&
85 + strcmp(value, "all") && strcmp(value, "none")) {
86 + warning("Invalid parameter \"%s\" for config option \"submodule.%s.ignore\"", value, var);
87 + return 0;
88 + }
89 +
90 + strbuf_add(&submodname, var, len - 7);
91 + config = unsorted_string_list_lookup(&config_ignore_for_name, submodname.buf);
92 + if (config)
93 + free(config->util);
94 + else
95 + config = string_list_append(&config_ignore_for_name,
96 + strbuf_detach(&submodname, NULL));
97 + strbuf_release(&submodname);
98 + config->util = xstrdup(value);
99 + return 0;
100 + }
101 + return 0;
102 +}
103 +
104 void handle_ignore_submodules_arg(struct diff_options *diffopt,
105 const char *arg)
106 {
@@ -55,7 +110,7 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt,
110 DIFF_OPT_SET(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES);
111 else if (!strcmp(arg, "dirty"))
112 DIFF_OPT_SET(diffopt, IGNORE_DIRTY_SUBMODULES);
58 - else
113 + else if (strcmp(arg, "none"))
114 die("bad --ignore-submodules argument: %s", arg);
115 }
116
submodule.h
+3
@@ -3,6 +3,9 @@
3
4 struct diff_options;
5
6 +void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
7 + const char *path);
8 +int parse_submodule_config_option(const char *var, const char *value);
9 void handle_ignore_submodules_arg(struct diff_options *diffopt, const char *);
10 void show_submodule_summary(FILE *f, const char *path,
11 unsigned char one[20], unsigned char two[20],
t/t4027-diff-submodule.sh
+76
@@ -114,6 +114,31 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)'
114 ! test -s actual4
115 '
116
117 +test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match) [.git/config]' '
118 + git config submodule.subname.ignore none &&
119 + git config submodule.subname.path sub &&
120 + git diff HEAD >actual &&
121 + sed -e "1,/^@@/d" actual >actual.body &&
122 + expect_from_to >expect.body $subprev $subprev-dirty &&
123 + test_cmp expect.body actual.body &&
124 + git config submodule.subname.ignore all &&
125 + git diff HEAD >actual2 &&
126 + ! test -s actual2 &&
127 + git config submodule.subname.ignore untracked &&
128 + git diff HEAD >actual3 &&
129 + sed -e "1,/^@@/d" actual3 >actual3.body &&
130 + expect_from_to >expect.body $subprev $subprev-dirty &&
131 + test_cmp expect.body actual3.body &&
132 + git config submodule.subname.ignore dirty &&
133 + git diff HEAD >actual4 &&
134 + ! test -s actual4 &&
135 + git diff HEAD --ignore-submodules=none >actual &&
136 + sed -e "1,/^@@/d" actual >actual.body &&
137 + expect_from_to >expect.body $subprev $subprev-dirty &&
138 + test_cmp expect.body actual.body &&
139 + git config --remove-section submodule.subname
140 +'
141 +
142 test_expect_success 'git diff HEAD with dirty submodule (index, refs match)' '
143 (
144 cd sub &&
@@ -146,6 +171,57 @@ test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match)'
171 ! test -s actual4
172 '
173
174 +test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match) [.git/config]' '
175 + git config submodule.subname.ignore all &&
176 + git config submodule.subname.path sub &&
177 + git diff HEAD >actual2 &&
178 + ! test -s actual2 &&
179 + git config submodule.subname.ignore untracked &&
180 + git diff HEAD >actual3 &&
181 + ! test -s actual3 &&
182 + git config submodule.subname.ignore dirty &&
183 + git diff HEAD >actual4 &&
184 + ! test -s actual4 &&
185 + git diff --ignore-submodules=none HEAD >actual &&
186 + sed -e "1,/^@@/d" actual >actual.body &&
187 + expect_from_to >expect.body $subprev $subprev-dirty &&
188 + test_cmp expect.body actual.body &&
189 + git config --remove-section submodule.subname
190 +'
191 +
192 +test_expect_success 'git diff between submodule commits' '
193 + git diff HEAD^..HEAD >actual &&
194 + sed -e "1,/^@@/d" actual >actual.body &&
195 + expect_from_to >expect.body $subtip $subprev &&
196 + test_cmp expect.body actual.body &&
197 + git diff --ignore-submodules=dirty HEAD^..HEAD >actual &&
198 + sed -e "1,/^@@/d" actual >actual.body &&
199 + expect_from_to >expect.body $subtip $subprev &&
200 + test_cmp expect.body actual.body &&
201 + git diff --ignore-submodules HEAD^..HEAD >actual &&
202 + ! test -s actual
203 +'
204 +
205 +test_expect_success 'git diff between submodule commits [.git/config]' '
206 + git diff HEAD^..HEAD >actual &&
207 + sed -e "1,/^@@/d" actual >actual.body &&
208 + expect_from_to >expect.body $subtip $subprev &&
209 + test_cmp expect.body actual.body &&
210 + git config submodule.subname.ignore dirty &&
211 + git config submodule.subname.path sub &&
212 + git diff HEAD^..HEAD >actual &&
213 + sed -e "1,/^@@/d" actual >actual.body &&
214 + expect_from_to >expect.body $subtip $subprev &&
215 + test_cmp expect.body actual.body &&
216 + git config submodule.subname.ignore all &&
217 + git diff HEAD^..HEAD >actual &&
218 + ! test -s actual &&
219 + git diff --ignore-submodules=dirty HEAD^..HEAD >actual &&
220 + sed -e "1,/^@@/d" actual >actual.body &&
221 + expect_from_to >expect.body $subtip $subprev &&
222 + git config --remove-section submodule.subname
223 +'
224 +
225 test_expect_success 'git diff (empty submodule dir)' '
226 : >empty &&
227 rm -rf sub/* sub/.git &&
t/t7508-status.sh
+96 -4
@@ -808,24 +808,38 @@ test_expect_success POSIXPERM 'status succeeds in a read-only repository' '
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' '
@@ -834,19 +848,48 @@ test_expect_success '--ignore-submodules=untracked suppresses submodules with un
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)
@@ -855,16 +898,21 @@ cat > expect << EOF
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" '
@@ -872,10 +920,23 @@ test_expect_success "--ignore-submodules=untracked doesn't suppress submodules w
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)
@@ -883,21 +944,26 @@ cat > expect << EOF
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" '
@@ -905,11 +971,28 @@ test_expect_success "--ignore-submodules=untracked doesn't suppress submodule su
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:
@@ -921,6 +1004,7 @@ cat > expect << EOF
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
@@ -935,4 +1019,12 @@ test_expect_success "--ignore-submodules=all suppresses submodule summary" '
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
wt-status.c
+6 -2
@@ -313,8 +313,10 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
313 DIFF_OPT_SET(&rev.diffopt, DIRTY_SUBMODULES);
314 if (!s->show_untracked_files)
315 DIFF_OPT_SET(&rev.diffopt, IGNORE_UNTRACKED_IN_SUBMODULES);
316 - if (s->ignore_submodule_arg)
316 + if (s->ignore_submodule_arg) {
317 + DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
318 handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
319 + }
320 rev.diffopt.format_callback = wt_status_collect_changed_cb;
321 rev.diffopt.format_callback_data = s;
322 rev.prune_data = s->pathspec;
@@ -331,8 +333,10 @@ static void wt_status_collect_changes_index(struct wt_status *s)
333 opt.def = s->is_initial ? EMPTY_TREE_SHA1_HEX : s->reference;
334 setup_revisions(0, NULL, &rev, &opt);
335
334 - if (s->ignore_submodule_arg)
336 + if (s->ignore_submodule_arg) {
337 + DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
338 handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
339 + }
340
341 rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
342 rev.diffopt.format_callback = wt_status_collect_updated_cb;