Blob Blame History Raw
diff -ruN git-2.9.3/t/t7400-submodule-basic.sh git-2.9.3_patched/t/t7400-submodule-basic.sh
--- git-2.9.3/t/t7400-submodule-basic.sh	2016-08-12 21:38:45.000000000 +0200
+++ git-2.9.3_patched/t/t7400-submodule-basic.sh	2018-10-24 17:15:18.869070834 +0200
@@ -38,6 +38,14 @@
 	test_i18ngrep "Submodule path .sub. not initialized" actual
 '
 
+test_expect_success 'submodule update aborts on missing gitmodules url' '
+	test_when_finished "git update-index --remove sub" &&
+	git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
+	test_when_finished "rm -f .gitmodules" &&
+	git config -f .gitmodules submodule.s.path sub &&
+	test_must_fail git submodule init
+'
+
 test_expect_success 'configuration parsing' '
 	test_when_finished "rm -f .gitmodules" &&
 	cat >.gitmodules <<-\EOF &&
diff -ruN git-2.9.3/t/t7416-submodule-dash-url.sh git-2.9.3_patched/t/t7416-submodule-dash-url.sh
--- git-2.9.3/t/t7416-submodule-dash-url.sh	1970-01-01 01:00:00.000000000 +0100
+++ git-2.9.3_patched/t/t7416-submodule-dash-url.sh	2018-10-24 17:14:53.014897346 +0200
@@ -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 -ruN git-2.9.3/t/t7417-submodule-path-url.sh git-2.9.3_patched/t/t7417-submodule-path-url.sh
--- git-2.9.3/t/t7417-submodule-path-url.sh	1970-01-01 01:00:00.000000000 +0100
+++ git-2.9.3_patched/t/t7417-submodule-path-url.sh	2018-10-24 17:13:59.893500178 +0200
@@ -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" &&
+	test_might_fail git clone --recurse-submodules . dst 2>err &&
+	test_i18ngrep ignoring err
+'
+
+test_done