]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/t3NNN: allow local submodules
authorTaylor Blau <me@ttaylorr.com>
Fri, 29 Jul 2022 19:20:28 +0000 (15:20 -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/t3200-branch.sh
t/t3420-rebase-autostash.sh
t/t3426-rebase-submodule.sh
t/t3512-cherry-pick-submodule.sh
t/t3600-rm.sh
t/t3906-stash-submodule.sh

index 3ec3e1d730339961853e5ab4e6b31a2f33b238df..631a0b506af5c3a4a4dc89b42dc8d59322b08d0c 100755 (executable)
@@ -279,6 +279,7 @@ test_expect_success 'deleting checked-out branch from repo that is a submodule'
        git init repo1 &&
        git init repo1/sub &&
        test_commit -C repo1/sub x &&
+       test_config_global protocol.file.allow always &&
        git -C repo1 submodule add ./sub &&
        git -C repo1 commit -m "adding sub" &&
 
index ca331733fbb58e7d9f4c2e27d186b24170e56b36..80df13a9a90d4647289a0b2e544e8c696c0dbefc 100755 (executable)
@@ -307,7 +307,7 @@ test_expect_success 'autostash is saved on editor failure with conflict' '
 test_expect_success 'autostash with dirty submodules' '
        test_when_finished "git reset --hard && git checkout master" &&
        git checkout -b with-submodule &&
-       git submodule add ./ sub &&
+       git -c protocol.file.allow=always submodule add ./ sub &&
        test_tick &&
        git commit -m add-submodule &&
        echo changed >sub/file0 &&
index 0ad3a07bf470939a8fa53f38e83fa609f2d7371f..fb21f675bb94c143d10b754f8ff59472b44eb567 100755 (executable)
@@ -47,7 +47,8 @@ test_expect_success 'rebase interactive ignores modified submodules' '
        git init sub &&
        git -C sub commit --allow-empty -m "Initial commit" &&
        git init super &&
-       git -C super submodule add ../sub &&
+       git -c protocol.file.allow=always \
+               -C super submodule add ../sub &&
        git -C super config submodule.sub.ignore dirty &&
        >super/foo &&
        git -C super add foo &&
index 6ece1d85736ade855d661a7e34d687e6a85d656b..697bc689587f7cd56cfd008606194edb670ab466 100755 (executable)
@@ -10,6 +10,8 @@ KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
 test_submodule_switch "cherry-pick"
 
 test_expect_success 'unrelated submodule/file conflict is ignored' '
+       test_config_global protocol.file.allow always &&
+
        test_create_repo sub &&
 
        touch sub/file &&
index efec8d13b661826af434db6b891a404118301735..99dab763325d9c2f8b7afd4889dc1166474dd909 100755 (executable)
@@ -321,7 +321,7 @@ test_expect_success 'rm removes empty submodules from work tree' '
 
 test_expect_success 'rm removes removed submodule from index and .gitmodules' '
        git reset --hard &&
-       git submodule update &&
+       git -c protocol.file.allow=always submodule update &&
        rm -rf submod &&
        git rm submod &&
        git status -s -uno --ignore-submodules=none >actual &&
@@ -627,6 +627,7 @@ cat >expect.deepmodified <<EOF
 EOF
 
 test_expect_success 'setup subsubmodule' '
+       test_config_global protocol.file.allow always &&
        git reset --hard &&
        git submodule update &&
        (
index a52e53dd2da481e3c24a82d9599a58c0d1c5ab43..0f7348ec21b8821cb6b7594919bbc637ec0a7236 100755 (executable)
@@ -36,7 +36,7 @@ setup_basic () {
        git init main &&
        (
                cd main &&
-               git submodule add ../sub &&
+               git -c protocol.file.allow=always submodule add ../sub &&
                test_commit main_file
        )
 }