Skip to content

Commit f8d510e

Browse files
committed
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 <[email protected]>
1 parent 99f4abb commit f8d510e

File tree

6 files changed

+9
-4
lines changed

6 files changed

+9
-4
lines changed

t/t3200-branch.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ test_expect_success 'deleting checked-out branch from repo that is a submodule'
279279
git init repo1 &&
280280
git init repo1/sub &&
281281
test_commit -C repo1/sub x &&
282+
test_config_global protocol.file.allow always &&
282283
git -C repo1 submodule add ./sub &&
283284
git -C repo1 commit -m "adding sub" &&
284285

t/t3420-rebase-autostash.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ test_expect_success 'autostash is saved on editor failure with conflict' '
307307
test_expect_success 'autostash with dirty submodules' '
308308
test_when_finished "git reset --hard && git checkout master" &&
309309
git checkout -b with-submodule &&
310-
git submodule add ./ sub &&
310+
git -c protocol.file.allow=always submodule add ./ sub &&
311311
test_tick &&
312312
git commit -m add-submodule &&
313313
echo changed >sub/file0 &&

t/t3426-rebase-submodule.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ test_expect_success 'rebase interactive ignores modified submodules' '
4747
git init sub &&
4848
git -C sub commit --allow-empty -m "Initial commit" &&
4949
git init super &&
50-
git -C super submodule add ../sub &&
50+
git -c protocol.file.allow=always \
51+
-C super submodule add ../sub &&
5152
git -C super config submodule.sub.ignore dirty &&
5253
>super/foo &&
5354
git -C super add foo &&

t/t3512-cherry-pick-submodule.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
1010
test_submodule_switch "cherry-pick"
1111

1212
test_expect_success 'unrelated submodule/file conflict is ignored' '
13+
test_config_global protocol.file.allow always &&
14+
1315
test_create_repo sub &&
1416
1517
touch sub/file &&

t/t3600-rm.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ test_expect_success 'rm removes empty submodules from work tree' '
321321

322322
test_expect_success 'rm removes removed submodule from index and .gitmodules' '
323323
git reset --hard &&
324-
git submodule update &&
324+
git -c protocol.file.allow=always submodule update &&
325325
rm -rf submod &&
326326
git rm submod &&
327327
git status -s -uno --ignore-submodules=none >actual &&
@@ -627,6 +627,7 @@ cat >expect.deepmodified <<EOF
627627
EOF
628628

629629
test_expect_success 'setup subsubmodule' '
630+
test_config_global protocol.file.allow always &&
630631
git reset --hard &&
631632
git submodule update &&
632633
(

t/t3906-stash-submodule.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ setup_basic () {
3636
git init main &&
3737
(
3838
cd main &&
39-
git submodule add ../sub &&
39+
git -c protocol.file.allow=always submodule add ../sub &&
4040
test_commit main_file
4141
)
4242
}

0 commit comments

Comments
 (0)