t/t3NNN: allow local submodules

To prepare for the default value of `protocol.file.allow` to change to "user", ensure tests that rely on local submodules can initialize them over the file protocol. Tests that only need to interact with submodules in a limited capacity have individual Git commands annotated with the appropriate configuration via `-c`. Tests that interact with submodules a handful of times use `test_config_global` instead. Test scripts that rely on submodules throughout use a `git config --global` during a setup test towards the beginning of the script. Signed-off-by: Taylor Blau <me@ttaylorr.com>

Taylor Blau committed Jul 29, 2022 at 15:20 UTC f8d510ed0b357787c8d035d64f240bd82b424dc4
6 files changed +9 -4
t/t3200-branch.sh
+1
@@ -279,6 +279,7 @@ test_expect_success 'deleting checked-out branch from repo that is a submodule'
279 git init repo1 &&
280 git init repo1/sub &&
281 test_commit -C repo1/sub x &&
282 + test_config_global protocol.file.allow always &&
283 git -C repo1 submodule add ./sub &&
284 git -C repo1 commit -m "adding sub" &&
285
t/t3420-rebase-autostash.sh
+1 -1
@@ -307,7 +307,7 @@ test_expect_success 'autostash is saved on editor failure with conflict' '
307 test_expect_success 'autostash with dirty submodules' '
308 test_when_finished "git reset --hard && git checkout master" &&
309 git checkout -b with-submodule &&
310 - git submodule add ./ sub &&
310 + git -c protocol.file.allow=always submodule add ./ sub &&
311 test_tick &&
312 git commit -m add-submodule &&
313 echo changed >sub/file0 &&
t/t3426-rebase-submodule.sh
+2 -1
@@ -47,7 +47,8 @@ test_expect_success 'rebase interactive ignores modified submodules' '
47 git init sub &&
48 git -C sub commit --allow-empty -m "Initial commit" &&
49 git init super &&
50 - git -C super submodule add ../sub &&
50 + git -c protocol.file.allow=always \
51 + -C super submodule add ../sub &&
52 git -C super config submodule.sub.ignore dirty &&
53 >super/foo &&
54 git -C super add foo &&
t/t3512-cherry-pick-submodule.sh
+2
@@ -10,6 +10,8 @@ KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
10 test_submodule_switch "cherry-pick"
11
12 test_expect_success 'unrelated submodule/file conflict is ignored' '
13 + test_config_global protocol.file.allow always &&
14 +
15 test_create_repo sub &&
16
17 touch sub/file &&
t/t3600-rm.sh
+2 -1
@@ -321,7 +321,7 @@ test_expect_success 'rm removes empty submodules from work tree' '
321
322 test_expect_success 'rm removes removed submodule from index and .gitmodules' '
323 git reset --hard &&
324 - git submodule update &&
324 + git -c protocol.file.allow=always submodule update &&
325 rm -rf submod &&
326 git rm submod &&
327 git status -s -uno --ignore-submodules=none >actual &&
@@ -627,6 +627,7 @@ cat >expect.deepmodified <<EOF
627 EOF
628
629 test_expect_success 'setup subsubmodule' '
630 + test_config_global protocol.file.allow always &&
631 git reset --hard &&
632 git submodule update &&
633 (
t/t3906-stash-submodule.sh
+1 -1
@@ -36,7 +36,7 @@ setup_basic () {
36 git init main &&
37 (
38 cd main &&
39 - git submodule add ../sub &&
39 + git -c protocol.file.allow=always submodule add ../sub &&
40 test_commit main_file
41 )
42 }