]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/t7NNN: allow local submodules
authorTaylor Blau <me@ttaylorr.com>
Fri, 29 Jul 2022 19:21:40 +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>
23 files changed:
t/t7001-mv.sh
t/t7064-wtstatus-pv2.sh
t/t7300-clean.sh
t/t7400-submodule-basic.sh
t/t7403-submodule-sync.sh
t/t7406-submodule-update.sh
t/t7407-submodule-foreach.sh
t/t7408-submodule-reference.sh
t/t7409-submodule-detached-work-tree.sh
t/t7411-submodule-config.sh
t/t7413-submodule-is-active.sh
t/t7414-submodule-mistakes.sh
t/t7415-submodule-names.sh
t/t7416-submodule-dash-url.sh
t/t7417-submodule-path-url.sh
t/t7418-submodule-sparse-gitmodules.sh
t/t7419-submodule-set-branch.sh
t/t7420-submodule-set-url.sh
t/t7421-submodule-summary-add.sh
t/t7506-status-submodule.sh
t/t7507-commit-verbose.sh
t/t7800-difftool.sh
t/t7814-grep-recurse-submodules.sh

index 63d5f41a1247839412b9c6022fb3f4a07c4e6b0e..6156eeb9ade72cb1ccbbe6763fd595f90a07dfc1 100755 (executable)
@@ -307,6 +307,7 @@ test_expect_success SYMLINKS 'check moved symlink' '
 rm -f moved symlink
 
 test_expect_success 'setup submodule' '
+       test_config_global protocol.file.allow always &&
        git commit -m initial &&
        git reset --hard &&
        git submodule add ./. sub &&
@@ -513,6 +514,7 @@ test_expect_success 'moving a submodule in nested directories' '
 '
 
 test_expect_success 'moving nested submodules' '
+       test_config_global protocol.file.allow always &&
        git commit -am "cleanup commit" &&
        mkdir sub_nested_nested &&
        (cd sub_nested_nested &&
index 601b47830bf520c90b72a5be4d9a0ca7e6883f1d..2fdb6ecc172cf36a569c02b44cd136941f34684e 100755 (executable)
@@ -462,6 +462,7 @@ test_expect_success 'create and add submodule, submodule appears clean (A. S...)
        git checkout initial-branch &&
        git clone . sub_repo &&
        git clone . super_repo &&
+       test_config_global protocol.file.allow always &&
        (       cd super_repo &&
                git submodule add ../sub_repo sub1 &&
 
index cb5e34d94c3a163ecc3785d4b3afdeeb98c60ec6..713f113a4a748f0ea0444ae34de5b6024d1d92c6 100755 (executable)
@@ -480,6 +480,7 @@ test_expect_success 'should not clean submodules' '
                git init &&
                test_commit msg hello.world
        ) &&
+       test_config_global protocol.file.allow always &&
        git submodule add ./repo/.git sub1 &&
        git commit -m "sub1" &&
        git branch before_sub2 &&
index fec7e0299dec2614cad243c2520423fe56ce6605..bf1a4dfadb16821406237225365f638353b70d97 100755 (executable)
@@ -11,6 +11,10 @@ subcommands of git submodule.
 
 . ./test-lib.sh
 
+test_expect_success 'setup - enable local submodules' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'submodule deinit works on empty repository' '
        git submodule deinit --all
 '
index 0726799e74e7a587e920c35f356b3364737b70d2..3bc904bacbc716528168563fdf63a4305c147941 100755 (executable)
@@ -11,6 +11,8 @@ These tests exercise the "git submodule sync" subcommand.
 . ./test-lib.sh
 
 test_expect_success setup '
+       git config --global protocol.file.allow always &&
+
        echo file >file &&
        git add file &&
        test_tick &&
index acb8766ac260a6d85f1806bdc65c01d9c79013ba..328b9b70129591ef9e5d7554bc4a6d61113379be 100755 (executable)
@@ -22,6 +22,7 @@ compare_head()
 
 
 test_expect_success 'setup a submodule tree' '
+       git config --global protocol.file.allow always &&
        echo file > file &&
        git add file &&
        test_tick &&
index 6b2aa917e11871eb403c8c79725b1e1944f8d29f..a3404ac3306e25d587de924d03a452b91272b6a9 100755 (executable)
@@ -13,6 +13,7 @@ that are currently checked out.
 
 
 test_expect_success 'setup a submodule tree' '
+       git config --global protocol.file.allow always &&
        echo file > file &&
        git add file &&
        test_tick &&
index a3892f494b68c866b150fdead376942bff47541b..02feb8577962687a81d9bc03ea330fcec2c5b6ee 100755 (executable)
@@ -17,6 +17,10 @@ test_alternate_is_used () {
        test_cmp expect actual
 }
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'preparing first repository' '
        test_create_repo A &&
        (
index fc018e3638a8bebebf0f1c689567e9867bfbbee8..e12eed5a30135cc848535cbfbcb1e9f613065b9b 100755 (executable)
@@ -12,6 +12,10 @@ on detached working trees
 TEST_NO_CREATE_REPO=1
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'submodule on detached working tree' '
        git init --bare remote &&
        test_create_repo bundle1 &&
index ad28e9388053c4009f4af3121788951f9e79d848..c583c4e373ad0de2a0b51080010da995646dff3a 100755 (executable)
@@ -12,6 +12,9 @@ from the database and from the worktree works.
 TEST_NO_CREATE_REPO=1
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
 test_expect_success 'submodule config cache setup' '
        mkdir submodule &&
        (cd submodule &&
index c8e7e983317610b54da89101bea8f7c59a4dcec3..c8b5ac2928f5a92a8a5c975b59a1ca7d3cf775a1 100755 (executable)
@@ -9,6 +9,7 @@ submodules which are "active" and interesting to the user.
 . ./test-lib.sh
 
 test_expect_success 'setup' '
+       git config --global protocol.file.allow always &&
        git init sub &&
        test_commit -C sub initial &&
        git init super &&
index f2e7df59cf24c254440a8bc1c7d5c195c8bfcd5b..cf95603d7d72042a0d5f21e477c900a2f23a8d40 100755 (executable)
@@ -30,7 +30,8 @@ test_expect_success 'no warning when updating entry' '
 
 test_expect_success 'submodule add does not warn' '
        test_when_finished "git rm -rf submodule .gitmodules" &&
-       git submodule add ./embed submodule 2>stderr &&
+       git -c protocol.file.allow=always \
+               submodule add ./embed submodule 2>stderr &&
        test_i18ngrep ! warning stderr
 '
 
index f70368bc2e9d42cc578ed4b46edac324bd1dddf1..f37456f15b260f2af0e40272efa40cd69d320940 100755 (executable)
@@ -8,6 +8,10 @@ real-world setup that confirms we catch this in practice.
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-pack.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'check names' '
        cat >expect <<-\EOF &&
        valid
index d21dc8b009f6d0d8e75368d01a984ac350155ba3..3ebd98598144c95165cc75870e6d586407add1c8 100755 (executable)
@@ -3,6 +3,10 @@
 test_description='check handling of disallowed .gitmodule urls'
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'create submodule with protected dash in url' '
        git init upstream &&
        git -C upstream commit --allow-empty -m base &&
index f7e7e94d7b6cfec6c625f6830b296b276572df66..b17d18034a3b1258ef0aa6d98b5031a14060d6f3 100755 (executable)
@@ -3,6 +3,10 @@
 test_description='check handling of .gitmodule path with dash'
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'create submodule with dash in path' '
        git init upstream &&
        git -C upstream commit --allow-empty -m base &&
index 3f7f27188313fb97e9e69e5be8d6c0b005b59e59..16331c34c446413721ac9c3d804244967699edda 100755 (executable)
@@ -14,6 +14,10 @@ also by committing .gitmodules and then just removing it from the filesystem.
 
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'sparse checkout setup which hides .gitmodules' '
        git init upstream &&
        git init submodule &&
index 3b925c302fc4e2194a2e0ad10c0b48823f2cf021..5357093e98ffbd1508d4e98c0e7ed904c789d119 100755 (executable)
@@ -12,6 +12,10 @@ as expected.
 TEST_NO_CREATE_REPO=1
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'submodule config cache setup' '
        mkdir submodule &&
        (cd submodule &&
index ef0cb6e8e185379dc853e16dcd7d2ea84ac8c9ff..d6bf62b3ac670fc0be8167150cdf79cbd9000a45 100755 (executable)
@@ -12,6 +12,10 @@ as expected.
 TEST_NO_CREATE_REPO=1
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'submodule config cache setup' '
        mkdir submodule &&
        (
index b070f13714a7ee194e513cffd143ef2b0039afe3..ce64d8b13721732a30d8739c72dfdba670060454 100755 (executable)
@@ -12,6 +12,10 @@ while making sure to add submodules using `git submodule add` instead of
 
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+       git config --global protocol.file.allow always
+'
+
 test_expect_success 'summary test environment setup' '
        git init sm &&
        test_commit -C sm "add file" file file-content file-tag &&
index 3fcb44767f51052f637683a34cbb8a2f21c777cc..459300c40bb211c7735cbd333d89041688168daa 100755 (executable)
@@ -251,6 +251,7 @@ test_expect_success 'status with merge conflict in .gitmodules' '
        test_create_repo_with_commit sub1 &&
        test_tick &&
        test_create_repo_with_commit sub2 &&
+       test_config_global protocol.file.allow always &&
        (
                cd super &&
                prev=$(git rev-parse HEAD) &&
@@ -326,6 +327,7 @@ test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
 # sub2 will have an untracked file
 # sub3 will have an untracked repository
 test_expect_success 'setup superproject with untracked file in nested submodule' '
+       test_config_global protocol.file.allow always &&
        (
                cd super &&
                git clean -dfx &&
index ed2653d46fe6cd0ed1dd5dc2dfd73f7340b8fe31..bd0ae4b1eabab4062ec897529846f6ffb3a8fd5c 100755 (executable)
@@ -74,6 +74,7 @@ test_expect_success 'diff in message is retained with -v' '
 
 test_expect_success 'submodule log is stripped out too with -v' '
        git config diff.submodule log &&
+       test_config_global protocol.file.allow always &&
        git submodule add ./. sub &&
        git commit -m "sub added" &&
        (
index a578b35761f2e97177dd8342ff5d949e719b64d3..cca50697b5166e195f921f6f734bd4b7933bdb07 100755 (executable)
@@ -626,6 +626,7 @@ test_expect_success 'difftool --no-symlinks detects conflict ' '
 
 test_expect_success 'difftool properly honors gitlink and core.worktree' '
        test_when_finished rm -rf submod/ule &&
+       test_config_global protocol.file.allow always &&
        git submodule add ./. submod/ule &&
        test_config -C submod/ule diff.tool checktrees &&
        test_config -C submod/ule difftool.checktrees.cmd '\''
index 828cb3ba5818fd47b6466fd52235e1d5a54cb333..f465c0d1403c974165b418d8a1836f90d0ebe53c 100755 (executable)
@@ -193,6 +193,7 @@ test_expect_success !MINGW 'grep recurse submodule colon in name' '
        git -C "su:b" commit -m "add fi:le" &&
        test_tick &&
 
+       test_config_global protocol.file.allow always &&
        git -C parent submodule add "../su:b" "su:b" &&
        git -C parent commit -m "add submodule" &&
        test_tick &&
@@ -227,6 +228,7 @@ test_expect_success 'grep history with moved submoules' '
        git -C sub commit -m "add file" &&
        test_tick &&
 
+       test_config_global protocol.file.allow always &&
        git -C parent submodule add ../sub dir/sub &&
        git -C parent commit -m "add submodule" &&
        test_tick &&
@@ -271,6 +273,7 @@ test_expect_success 'grep using relative path' '
        mkdir parent/src &&
        echo "(1|2)d(3|4)" >parent/src/file2 &&
        git -C parent add src/file2 &&
+       test_config_global protocol.file.allow always &&
        git -C parent submodule add ../sub &&
        git -C parent commit -m "add files and submodule" &&
        test_tick &&
@@ -313,6 +316,7 @@ test_expect_success 'grep from a subdir' '
        mkdir parent/src &&
        echo "(1|2)d(3|4)" >parent/src/file &&
        git -C parent add src/file &&
+       test_config_global protocol.file.allow always &&
        git -C parent submodule add ../sub src/sub &&
        git -C parent submodule add ../sub sub &&
        git -C parent commit -m "add files and submodules" &&