t/t4NNN: 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 ac7e57fa288260341bdbd5e9abcdd24eaf214740
4 files changed +5 -3
t/t4059-diff-submodule-not-initialized.sh
+1 -1
@@ -49,7 +49,7 @@ test_expect_success 'setup - submodules' '
49 '
50
51 test_expect_success 'setup - git submodule add' '
52 - git submodule add ./sm2 sm1 &&
52 + git -c protocol.file.allow=always submodule add ./sm2 sm1 &&
53 commit_file sm1 .gitmodules &&
54 git diff-tree -p --no-commit-id --submodule=log HEAD -- sm1 >actual &&
55 cat >expected <<-EOF &&
t/t4060-diff-submodule-option-diff-format.sh
+2 -2
@@ -759,9 +759,9 @@ test_expect_success 'diff --submodule=diff with .git file' '
759 '
760
761 test_expect_success 'setup nested submodule' '
762 - git submodule add -f ./sm2 &&
762 + git -c protocol.file.allow=always submodule add -f ./sm2 &&
763 git commit -a -m "add sm2" &&
764 - git -C sm2 submodule add ../sm2 nested &&
764 + git -c protocol.file.allow=always -C sm2 submodule add ../sm2 nested &&
765 git -C sm2 commit -a -m "nested sub" &&
766 head10=$(git -C sm2 rev-parse --short --verify HEAD)
767 '
t/t4067-diff-partial-clone.sh
+1
@@ -77,6 +77,7 @@ test_expect_success 'diff skips same-OID blobs' '
77
78 test_expect_success 'when fetching missing objects, diff skips GITLINKs' '
79 test_when_finished "rm -rf sub server client trace" &&
80 + test_config_global protocol.file.allow always &&
81
82 test_create_repo sub &&
83 test_commit -C sub first &&
t/t4208-log-magic-pathspec.sh
+1
@@ -126,6 +126,7 @@ test_expect_success 'command line pathspec parsing for "git log"' '
126
127 test_expect_success 'tree_entry_interesting does not match past submodule boundaries' '
128 test_when_finished "rm -rf repo submodule" &&
129 + test_config_global protocol.file.allow always &&
130 git init submodule &&
131 test_commit -C submodule initial &&
132 git init repo &&