Skip to content

Commit 078b75e

Browse files
bmwillgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2cc67fe commit 078b75e

File tree

2 files changed

+0
-70
lines changed

2 files changed

+0
-70
lines changed

diff.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,6 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)
346346
return 0;
347347
}
348348

349-
if (starts_with(var, "submodule."))
350-
return parse_submodule_config_option(var, value);
351-
352349
if (git_diff_heuristic_config(var, value, cb) < 0)
353350
return -1;
354351

t/t4027-diff-submodule.sh

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -113,35 +113,6 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)'
113113
! test -s actual4
114114
'
115115

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-
145116
test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match) [.gitmodules]' '
146117
git config diff.ignoreSubmodules dirty &&
147118
git diff HEAD >actual &&
@@ -208,24 +179,6 @@ test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match)'
208179
! test -s actual4
209180
'
210181

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-
229182
test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match) [.gitmodules]' '
230183
git config --add -f .gitmodules submodule.subname.ignore all &&
231184
git config --add -f .gitmodules submodule.subname.path sub &&
@@ -261,26 +214,6 @@ test_expect_success 'git diff between submodule commits' '
261214
! test -s actual
262215
'
263216

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-
284217
test_expect_success 'git diff between submodule commits [.gitmodules]' '
285218
git diff HEAD^..HEAD >actual &&
286219
sed -e "1,/^@@/d" actual >actual.body &&

0 commit comments

Comments
 (0)