summaryrefslogtreecommitdiff
path: root/t/t7450-bad-git-dotfiles.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t7450-bad-git-dotfiles.sh')
-rwxr-xr-xt/t7450-bad-git-dotfiles.sh46
1 files changed, 39 insertions, 7 deletions
diff --git a/t/t7450-bad-git-dotfiles.sh b/t/t7450-bad-git-dotfiles.sh
index 41706c1..46d4fb0 100755
--- a/t/t7450-bad-git-dotfiles.sh
+++ b/t/t7450-bad-git-dotfiles.sh
@@ -12,16 +12,22 @@ Such as:
- symlinked .gitmodules, etc
'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./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
valid/with/paths
EOF
- git submodule--helper check-name >actual <<-\EOF &&
+ test-tool submodule check-name >actual <<-\EOF &&
valid
valid/with/paths
@@ -39,6 +45,32 @@ test_expect_success 'check names' '
test_cmp expect actual
'
+test_expect_success 'check urls' '
+ cat >expect <<-\EOF &&
+ ./bar/baz/foo.git
+ https://example.com/foo.git
+ http://example.com:80/deeper/foo.git
+ EOF
+
+ test-tool submodule check-url >actual <<-\EOF &&
+ ./bar/baz/foo.git
+ https://example.com/foo.git
+ http://example.com:80/deeper/foo.git
+ -a./foo
+ ../../..//test/foo.git
+ ../../../../../:localhost:8080/foo.git
+ ..\../.\../:example.com/foo.git
+ ./%0ahost=example.com/foo.git
+ https://one.example.com/evil?%0ahost=two.example.com
+ https:///example.com/foo.git
+ http://example.com:test/foo.git
+ https::example.com/foo.git
+ http:::example.com/foo.git
+ EOF
+
+ test_cmp expect actual
+'
+
test_expect_success 'create innocent subrepo' '
git init innocent &&
git -C innocent commit --allow-empty -m foo
@@ -232,7 +264,7 @@ test_expect_success 'fsck detects non-blob .gitmodules' '
git ls-tree HEAD | sed s/subdir/.gitmodules/ | git mktree &&
test_must_fail git fsck 2>output &&
- test_i18ngrep gitmodulesBlob output
+ test_grep gitmodulesBlob output
)
'
@@ -246,8 +278,8 @@ test_expect_success 'fsck detects corrupt .gitmodules' '
git commit -m "broken gitmodules" &&
git fsck 2>output &&
- test_i18ngrep gitmodulesParse output &&
- test_i18ngrep ! "bad config" output
+ test_grep gitmodulesParse output &&
+ test_grep ! "bad config" output
)
'
@@ -269,7 +301,7 @@ test_expect_success WINDOWS 'prevent git~1 squatting on Windows' '
hash="$(echo x | git hash-object -w --stdin)" &&
test_must_fail git update-index --add \
--cacheinfo 160000,$rev,d\\a 2>err &&
- test_i18ngrep "Invalid path" err &&
+ test_grep "Invalid path" err &&
git -c core.protectNTFS=false update-index --add \
--cacheinfo 100644,$modules,.gitmodules \
--cacheinfo 160000,$rev,c \
@@ -283,7 +315,7 @@ test_expect_success WINDOWS 'prevent git~1 squatting on Windows' '
then
test_must_fail git -c core.protectNTFS=false \
clone --recurse-submodules squatting squatting-clone 2>err &&
- test_i18ngrep -e "directory not empty" -e "not an empty directory" err &&
+ test_grep -e "directory not empty" -e "not an empty directory" err &&
! grep gitdir squatting-clone/d/a/git~2
fi
'
@@ -308,7 +340,7 @@ test_expect_success 'git dirs of sibling submodules must not be nested' '
git commit -m nested
) &&
test_must_fail git clone --recurse-submodules nested clone 2>err &&
- test_i18ngrep "is inside git dir" err
+ test_grep "is inside git dir" err
'
test_done