Skip to content

Commit 225d2d5

Browse files
committed
t/t5NNN: 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 ac7e57f commit 225d2d5

8 files changed

+19
-0
lines changed

t/t5510-fetch.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ test_expect_success 'fetch.writeCommitGraph' '
627627
'
628628

629629
test_expect_success 'fetch.writeCommitGraph with submodules' '
630+
test_config_global protocol.file.allow always &&
630631
git clone dups super &&
631632
(
632633
cd super &&

t/t5526-fetch-submodules.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ add_upstream_commit() {
3535
}
3636

3737
test_expect_success setup '
38+
git config --global protocol.file.allow always &&
3839
mkdir deepsubmodule &&
3940
(
4041
cd deepsubmodule &&

t/t5545-push-options.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ test_expect_success 'push options and submodules' '
113113
test_commit -C parent one &&
114114
git -C parent push --mirror up &&
115115
116+
test_config_global protocol.file.allow always &&
116117
git -C parent submodule add ../upstream workbench &&
117118
git -C parent/workbench remote add up ../../upstream &&
118119
git -C parent commit -m "add submodule" &&

t/t5572-pull-submodule.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
4646
KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
4747
test_submodule_switch_func "git_pull_noff"
4848

49+
test_expect_success 'setup' '
50+
git config --global protocol.file.allow always
51+
'
52+
4953
test_expect_success 'pull --recurse-submodule setup' '
5054
test_create_repo child &&
5155
test_commit -C child bar &&

t/t5601-clone.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,7 @@ test_expect_success 'batch missing blob request does not inadvertently try to fe
738738
echo aa >server/a &&
739739
echo bb >server/b &&
740740
# Also add a gitlink pointing to an arbitrary repository
741+
test_config_global protocol.file.allow always &&
741742
git -C server submodule add "$(pwd)/repo_for_submodule" c &&
742743
git -C server add a b c &&
743744
git -C server commit -m x &&

t/t5614-clone-submodules-shallow.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ test_expect_success 'setup' '
2424

2525
test_expect_success 'nonshallow clone implies nonshallow submodule' '
2626
test_when_finished "rm -rf super_clone" &&
27+
test_config_global protocol.file.allow always &&
2728
git clone --recurse-submodules "file://$pwd/." super_clone &&
2829
git -C super_clone log --oneline >lines &&
2930
test_line_count = 3 lines &&
@@ -33,6 +34,7 @@ test_expect_success 'nonshallow clone implies nonshallow submodule' '
3334

3435
test_expect_success 'shallow clone with shallow submodule' '
3536
test_when_finished "rm -rf super_clone" &&
37+
test_config_global protocol.file.allow always &&
3638
git clone --recurse-submodules --depth 2 --shallow-submodules "file://$pwd/." super_clone &&
3739
git -C super_clone log --oneline >lines &&
3840
test_line_count = 2 lines &&
@@ -42,6 +44,7 @@ test_expect_success 'shallow clone with shallow submodule' '
4244

4345
test_expect_success 'shallow clone does not imply shallow submodule' '
4446
test_when_finished "rm -rf super_clone" &&
47+
test_config_global protocol.file.allow always &&
4548
git clone --recurse-submodules --depth 2 "file://$pwd/." super_clone &&
4649
git -C super_clone log --oneline >lines &&
4750
test_line_count = 2 lines &&
@@ -51,6 +54,7 @@ test_expect_success 'shallow clone does not imply shallow submodule' '
5154

5255
test_expect_success 'shallow clone with non shallow submodule' '
5356
test_when_finished "rm -rf super_clone" &&
57+
test_config_global protocol.file.allow always &&
5458
git clone --recurse-submodules --depth 2 --no-shallow-submodules "file://$pwd/." super_clone &&
5559
git -C super_clone log --oneline >lines &&
5660
test_line_count = 2 lines &&
@@ -60,6 +64,7 @@ test_expect_success 'shallow clone with non shallow submodule' '
6064

6165
test_expect_success 'non shallow clone with shallow submodule' '
6266
test_when_finished "rm -rf super_clone" &&
67+
test_config_global protocol.file.allow always &&
6368
git clone --recurse-submodules --no-local --shallow-submodules "file://$pwd/." super_clone &&
6469
git -C super_clone log --oneline >lines &&
6570
test_line_count = 3 lines &&
@@ -69,6 +74,7 @@ test_expect_success 'non shallow clone with shallow submodule' '
6974

7075
test_expect_success 'clone follows shallow recommendation' '
7176
test_when_finished "rm -rf super_clone" &&
77+
test_config_global protocol.file.allow always &&
7278
git config -f .gitmodules submodule.sub.shallow true &&
7379
git add .gitmodules &&
7480
git commit -m "recommend shallow for sub" &&
@@ -87,6 +93,7 @@ test_expect_success 'clone follows shallow recommendation' '
8793

8894
test_expect_success 'get unshallow recommended shallow submodule' '
8995
test_when_finished "rm -rf super_clone" &&
96+
test_config_global protocol.file.allow always &&
9097
git clone --no-local "file://$pwd/." super_clone &&
9198
(
9299
cd super_clone &&
@@ -103,6 +110,7 @@ test_expect_success 'get unshallow recommended shallow submodule' '
103110

104111
test_expect_success 'clone follows non shallow recommendation' '
105112
test_when_finished "rm -rf super_clone" &&
113+
test_config_global protocol.file.allow always &&
106114
git config -f .gitmodules submodule.sub.shallow false &&
107115
git add .gitmodules &&
108116
git commit -m "recommend non shallow for sub" &&

t/t5616-partial-clone.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ test_expect_success 'partial clone with transfer.fsckobjects=1 works with submod
171171
test_config -C src_with_sub uploadpack.allowfilter 1 &&
172172
test_config -C src_with_sub uploadpack.allowanysha1inwant 1 &&
173173
174+
test_config_global protocol.file.allow always &&
175+
174176
git -C src_with_sub submodule add "file://$(pwd)/submodule" mysub &&
175177
git -C src_with_sub commit -m "commit with submodule" &&
176178

t/t5617-clone-submodules-remote.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ test_description='Test cloning repos with submodules using remote-tracking branc
77
pwd=$(pwd)
88

99
test_expect_success 'setup' '
10+
git config --global protocol.file.allow always &&
1011
git checkout -b master &&
1112
test_commit commit1 &&
1213
mkdir sub &&

0 commit comments

Comments
 (0)