]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/t5NNN: allow local submodules
authorTaylor Blau <me@ttaylorr.com>
Fri, 29 Jul 2022 19:21:06 +0000 (15:21 -0400)
committerTaylor Blau <me@ttaylorr.com>
Sat, 1 Oct 2022 04:23:38 +0000 (00:23 -0400)
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>
t/t5510-fetch.sh
t/t5526-fetch-submodules.sh
t/t5545-push-options.sh
t/t5572-pull-submodule.sh
t/t5601-clone.sh
t/t5614-clone-submodules-shallow.sh
t/t5616-partial-clone.sh
t/t5617-clone-submodules-remote.sh

index 2013051a64eae596505597114f47c20c0a6dcc06..b60ba0f7882223b513fa16657738af0e33d4686f 100755 (executable)
@@ -627,6 +627,7 @@ test_expect_success 'fetch.writeCommitGraph' '
 '
 
 test_expect_success 'fetch.writeCommitGraph with submodules' '
+       test_config_global protocol.file.allow always &&
        git clone dups super &&
        (
                cd super &&
index 53d7b8ed7571f54d4c714f6945a62ab8ced3d86f..aa04eacb652d909fe5b52014a4903bc6b085c4ea 100755 (executable)
@@ -35,6 +35,7 @@ add_upstream_commit() {
 }
 
 test_expect_success setup '
+       git config --global protocol.file.allow always &&
        mkdir deepsubmodule &&
        (
                cd deepsubmodule &&
index 38e6f7340e74474b6899eff3543e7af31f1bf0cf..77ce917cdd8be548e724076f1e36f52a056feaac 100755 (executable)
@@ -113,6 +113,7 @@ test_expect_success 'push options and submodules' '
        test_commit -C parent one &&
        git -C parent push --mirror up &&
 
+       test_config_global protocol.file.allow always &&
        git -C parent submodule add ../upstream workbench &&
        git -C parent/workbench remote add up ../../upstream &&
        git -C parent commit -m "add submodule" &&
index 37fd06b0be8f488889554696fceb7d0be615f89f..9b3b4af61078992722e6711ce625bc717b372eb0 100755 (executable)
@@ -46,6 +46,10 @@ KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
 KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
 test_submodule_switch_func "git_pull_noff"
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'pull --recurse-submodule setup' '
        test_create_repo child &&
        test_commit -C child bar &&
index 7df3c5373ae605098b52fb8d2771ada81efbebee..50d482114d8ac3e8b039601a7a0de547763cb7f1 100755 (executable)
@@ -738,6 +738,7 @@ test_expect_success 'batch missing blob request does not inadvertently try to fe
        echo aa >server/a &&
        echo bb >server/b &&
        # Also add a gitlink pointing to an arbitrary repository
+       test_config_global protocol.file.allow always &&
        git -C server submodule add "$(pwd)/repo_for_submodule" c &&
        git -C server add a b c &&
        git -C server commit -m x &&
index e4e6ea4d527faa46ca30d0f09839bc3ac0aa2392..d361738b51514679e533ff633007bb820c3e1f7d 100755 (executable)
@@ -24,6 +24,7 @@ test_expect_success 'setup' '
 
 test_expect_success 'nonshallow clone implies nonshallow submodule' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git clone --recurse-submodules "file://$pwd/." super_clone &&
        git -C super_clone log --oneline >lines &&
        test_line_count = 3 lines &&
@@ -33,6 +34,7 @@ test_expect_success 'nonshallow clone implies nonshallow submodule' '
 
 test_expect_success 'shallow clone with shallow submodule' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git clone --recurse-submodules --depth 2 --shallow-submodules "file://$pwd/." super_clone &&
        git -C super_clone log --oneline >lines &&
        test_line_count = 2 lines &&
@@ -42,6 +44,7 @@ test_expect_success 'shallow clone with shallow submodule' '
 
 test_expect_success 'shallow clone does not imply shallow submodule' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git clone --recurse-submodules --depth 2 "file://$pwd/." super_clone &&
        git -C super_clone log --oneline >lines &&
        test_line_count = 2 lines &&
@@ -51,6 +54,7 @@ test_expect_success 'shallow clone does not imply shallow submodule' '
 
 test_expect_success 'shallow clone with non shallow submodule' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git clone --recurse-submodules --depth 2 --no-shallow-submodules "file://$pwd/." super_clone &&
        git -C super_clone log --oneline >lines &&
        test_line_count = 2 lines &&
@@ -60,6 +64,7 @@ test_expect_success 'shallow clone with non shallow submodule' '
 
 test_expect_success 'non shallow clone with shallow submodule' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git clone --recurse-submodules --no-local --shallow-submodules "file://$pwd/." super_clone &&
        git -C super_clone log --oneline >lines &&
        test_line_count = 3 lines &&
@@ -69,6 +74,7 @@ test_expect_success 'non shallow clone with shallow submodule' '
 
 test_expect_success 'clone follows shallow recommendation' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git config -f .gitmodules submodule.sub.shallow true &&
        git add .gitmodules &&
        git commit -m "recommend shallow for sub" &&
@@ -87,6 +93,7 @@ test_expect_success 'clone follows shallow recommendation' '
 
 test_expect_success 'get unshallow recommended shallow submodule' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git clone --no-local "file://$pwd/." super_clone &&
        (
                cd super_clone &&
@@ -103,6 +110,7 @@ test_expect_success 'get unshallow recommended shallow submodule' '
 
 test_expect_success 'clone follows non shallow recommendation' '
        test_when_finished "rm -rf super_clone" &&
+       test_config_global protocol.file.allow always &&
        git config -f .gitmodules submodule.sub.shallow false &&
        git add .gitmodules &&
        git commit -m "recommend non shallow for sub" &&
index d98c550267159173cc0f609712054e48854ae1c0..a6138e8cfc334d667521d64fb74f4434a1e549cb 100755 (executable)
@@ -171,6 +171,8 @@ test_expect_success 'partial clone with transfer.fsckobjects=1 works with submod
        test_config -C src_with_sub uploadpack.allowfilter 1 &&
        test_config -C src_with_sub uploadpack.allowanysha1inwant 1 &&
 
+       test_config_global protocol.file.allow always &&
+
        git -C src_with_sub submodule add "file://$(pwd)/submodule" mysub &&
        git -C src_with_sub commit -m "commit with submodule" &&
 
index 1a041df10bee558bf4b643f42d4ffa876fefbc14..0152dc04400fffc513a8b01774abf2c5fed535ff 100755 (executable)
@@ -7,6 +7,7 @@ test_description='Test cloning repos with submodules using remote-tracking branc
 pwd=$(pwd)
 
 test_expect_success 'setup' '
+       git config --global protocol.file.allow always &&
        git checkout -b master &&
        test_commit commit1 &&
        mkdir sub &&