diff: stop allowing diff to have submodules configured in .git/config

Traditionally a submodule is comprised of a gitlink as well as a corresponding entry in the .gitmodules file. Diff doesn't follow this paradigm as its config callback routine falls back to populating the submodule-config if a config entry starts with 'submodule.'. Remove this behavior in order to be consistent with how the submodule-config is populated, via calling 'gitmodules_config()' or 'repo_read_gitmodules()'. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed Aug 3, 2017 at 11:19 UTC 078b75e99be00155eac3ec2d4eaa0ae0941ff54d
2 files changed -70
diff.c
-3
@@ -346,9 +346,6 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)
346 return 0;
347 }
348
349 - if (starts_with(var, "submodule."))
350 - return parse_submodule_config_option(var, value);
351 -
349 if (git_diff_heuristic_config(var, value, cb) < 0)
350 return -1;
351
t/t4027-diff-submodule.sh
-67
@@ -113,35 +113,6 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)'
113 ! test -s actual4
114 '
115
116 -test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match) [.git/config]' '
117 - git config diff.ignoreSubmodules all &&
118 - git diff HEAD >actual &&
119 - ! test -s actual &&
120 - git config submodule.subname.ignore none &&
121 - git config submodule.subname.path sub &&
122 - git diff HEAD >actual &&
123 - sed -e "1,/^@@/d" actual >actual.body &&
124 - expect_from_to >expect.body $subprev $subprev-dirty &&
125 - test_cmp expect.body actual.body &&
126 - git config submodule.subname.ignore all &&
127 - git diff HEAD >actual2 &&
128 - ! test -s actual2 &&
129 - git config submodule.subname.ignore untracked &&
130 - git diff HEAD >actual3 &&
131 - sed -e "1,/^@@/d" actual3 >actual3.body &&
132 - expect_from_to >expect.body $subprev $subprev-dirty &&
133 - test_cmp expect.body actual3.body &&
134 - git config submodule.subname.ignore dirty &&
135 - git diff HEAD >actual4 &&
136 - ! test -s actual4 &&
137 - git diff HEAD --ignore-submodules=none >actual &&
138 - sed -e "1,/^@@/d" actual >actual.body &&
139 - expect_from_to >expect.body $subprev $subprev-dirty &&
140 - test_cmp expect.body actual.body &&
141 - git config --remove-section submodule.subname &&
142 - git config --unset diff.ignoreSubmodules
143 -'
144 -
116 test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match) [.gitmodules]' '
117 git config diff.ignoreSubmodules dirty &&
118 git diff HEAD >actual &&
@@ -208,24 +179,6 @@ test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match)'
179 ! test -s actual4
180 '
181
211 -test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match) [.git/config]' '
212 - git config submodule.subname.ignore all &&
213 - git config submodule.subname.path sub &&
214 - git diff HEAD >actual2 &&
215 - ! test -s actual2 &&
216 - git config submodule.subname.ignore untracked &&
217 - git diff HEAD >actual3 &&
218 - ! test -s actual3 &&
219 - git config submodule.subname.ignore dirty &&
220 - git diff HEAD >actual4 &&
221 - ! test -s actual4 &&
222 - git diff --ignore-submodules=none HEAD >actual &&
223 - sed -e "1,/^@@/d" actual >actual.body &&
224 - expect_from_to >expect.body $subprev $subprev-dirty &&
225 - test_cmp expect.body actual.body &&
226 - git config --remove-section submodule.subname
227 -'
228 -
182 test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match) [.gitmodules]' '
183 git config --add -f .gitmodules submodule.subname.ignore all &&
184 git config --add -f .gitmodules submodule.subname.path sub &&
@@ -261,26 +214,6 @@ test_expect_success 'git diff between submodule commits' '
214 ! test -s actual
215 '
216
264 -test_expect_success 'git diff between submodule commits [.git/config]' '
265 - git diff HEAD^..HEAD >actual &&
266 - sed -e "1,/^@@/d" actual >actual.body &&
267 - expect_from_to >expect.body $subtip $subprev &&
268 - test_cmp expect.body actual.body &&
269 - git config submodule.subname.ignore dirty &&
270 - git config submodule.subname.path sub &&
271 - git diff HEAD^..HEAD >actual &&
272 - sed -e "1,/^@@/d" actual >actual.body &&
273 - expect_from_to >expect.body $subtip $subprev &&
274 - test_cmp expect.body actual.body &&
275 - git config submodule.subname.ignore all &&
276 - git diff HEAD^..HEAD >actual &&
277 - ! test -s actual &&
278 - git diff --ignore-submodules=dirty HEAD^..HEAD >actual &&
279 - sed -e "1,/^@@/d" actual >actual.body &&
280 - expect_from_to >expect.body $subtip $subprev &&
281 - git config --remove-section submodule.subname
282 -'
283 -
217 test_expect_success 'git diff between submodule commits [.gitmodules]' '
218 git diff HEAD^..HEAD >actual &&
219 sed -e "1,/^@@/d" actual >actual.body &&