summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-03-03 15:16:19 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-03-03 15:16:19 +0900
commitfbcf303bb31fc2ee5535aa7cb50fb6f312378673 (patch)
tree305614eadac735bf29ce3d208d26e46e149f8e83 /t
parent45f86faf7eca1bc0fe0e93fc365efec0b210fe07 (diff)
downloadgit-fbcf303bb31fc2ee5535aa7cb50fb6f312378673.tar.gz
git-fbcf303bb31fc2ee5535aa7cb50fb6f312378673.tar.bz2
git-fbcf303bb31fc2ee5535aa7cb50fb6f312378673.zip
Imported Upstream version 2.14.5upstream/2.14.5
Diffstat (limited to 't')
-rwxr-xr-xt/t7416-submodule-dash-url.sh34
-rwxr-xr-xt/t7417-submodule-path-url.sh20
2 files changed, 54 insertions, 0 deletions
diff --git a/t/t7416-submodule-dash-url.sh b/t/t7416-submodule-dash-url.sh
new file mode 100755
index 00000000..459193c9
--- /dev/null
+++ b/t/t7416-submodule-dash-url.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+test_description='check handling of .gitmodule url with dash'
+. ./test-lib.sh
+
+test_expect_success 'create submodule with protected dash in url' '
+ git init upstream &&
+ git -C upstream commit --allow-empty -m base &&
+ mv upstream ./-upstream &&
+ git submodule add ./-upstream sub &&
+ git add sub .gitmodules &&
+ git commit -m submodule
+'
+
+test_expect_success 'clone can recurse submodule' '
+ test_when_finished "rm -rf dst" &&
+ git clone --recurse-submodules . dst &&
+ echo base >expect &&
+ git -C dst/sub log -1 --format=%s >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'remove ./ protection from .gitmodules url' '
+ perl -i -pe "s{\./}{}" .gitmodules &&
+ git commit -am "drop protection"
+'
+
+test_expect_success 'clone rejects unprotected dash' '
+ test_when_finished "rm -rf dst" &&
+ test_must_fail git clone --recurse-submodules . dst 2>err &&
+ test_i18ngrep ignoring err
+'
+
+test_done
diff --git a/t/t7417-submodule-path-url.sh b/t/t7417-submodule-path-url.sh
new file mode 100755
index 00000000..638293f0
--- /dev/null
+++ b/t/t7417-submodule-path-url.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+test_description='check handling of .gitmodule path with dash'
+. ./test-lib.sh
+
+test_expect_success 'create submodule with dash in path' '
+ git init upstream &&
+ git -C upstream commit --allow-empty -m base &&
+ git submodule add ./upstream sub &&
+ git mv sub ./-sub &&
+ git commit -m submodule
+'
+
+test_expect_success 'clone rejects unprotected dash' '
+ test_when_finished "rm -rf dst" &&
+ git clone --recurse-submodules . dst 2>err &&
+ test_i18ngrep ignoring err
+'
+
+test_done