t/t7NNN: 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 <me@ttaylorr.com>
This commit is contained in:
parent
0f21b8f468
commit
0d3beb71da
@ -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 &&
|
||||
|
@ -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 &&
|
||||
|
||||
|
@ -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 &&
|
||||
|
@ -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
|
||||
'
|
||||
|
@ -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 &&
|
||||
|
@ -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 &&
|
||||
|
@ -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 &&
|
||||
|
@ -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 &&
|
||||
(
|
||||
|
@ -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 &&
|
||||
|
@ -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 &&
|
||||
|
@ -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 &&
|
||||
|
@ -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
|
||||
'
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 &&
|
||||
|
@ -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 &&
|
||||
|
@ -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 &&
|
||||
|
@ -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 &&
|
||||
|
@ -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 &&
|
||||
(
|
||||
|
@ -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 &&
|
||||
|
@ -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 &&
|
||||
|
@ -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" &&
|
||||
(
|
||||
|
@ -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 '\''
|
||||
|
@ -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" &&
|
||||
|
Loading…
Reference in New Issue
Block a user