Blame SOURCES/git-cve-2018-17456-arbitrary-execution-tests.patch

4e7677
diff -ruN git-2.9.3/t/t7400-submodule-basic.sh git-2.9.3_patched/t/t7400-submodule-basic.sh
4e7677
--- git-2.9.3/t/t7400-submodule-basic.sh	2016-08-12 21:38:45.000000000 +0200
4e7677
+++ git-2.9.3_patched/t/t7400-submodule-basic.sh	2018-10-24 17:15:18.869070834 +0200
4e7677
@@ -38,6 +38,14 @@
4e7677
 	test_i18ngrep "Submodule path .sub. not initialized" actual
4e7677
 '
4e7677
 
4e7677
+test_expect_success 'submodule update aborts on missing gitmodules url' '
4e7677
+	test_when_finished "git update-index --remove sub" &&
4e7677
+	git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
4e7677
+	test_when_finished "rm -f .gitmodules" &&
4e7677
+	git config -f .gitmodules submodule.s.path sub &&
4e7677
+	test_must_fail git submodule init
4e7677
+'
4e7677
+
4e7677
 test_expect_success 'configuration parsing' '
4e7677
 	test_when_finished "rm -f .gitmodules" &&
4e7677
 	cat >.gitmodules <<-\EOF &&
4e7677
diff -ruN git-2.9.3/t/t7416-submodule-dash-url.sh git-2.9.3_patched/t/t7416-submodule-dash-url.sh
4e7677
--- git-2.9.3/t/t7416-submodule-dash-url.sh	1970-01-01 01:00:00.000000000 +0100
4e7677
+++ git-2.9.3_patched/t/t7416-submodule-dash-url.sh	2018-10-24 17:14:53.014897346 +0200
4e7677
@@ -0,0 +1,34 @@
4e7677
+#!/bin/sh
4e7677
+
4e7677
+test_description='check handling of .gitmodule url with dash'
4e7677
+. ./test-lib.sh
4e7677
+
4e7677
+test_expect_success 'create submodule with protected dash in url' '
4e7677
+	git init upstream &&
4e7677
+	git -C upstream commit --allow-empty -m base &&
4e7677
+	mv upstream ./-upstream &&
4e7677
+	git submodule add ./-upstream sub &&
4e7677
+	git add sub .gitmodules &&
4e7677
+	git commit -m submodule
4e7677
+'
4e7677
+
4e7677
+test_expect_success 'clone can recurse submodule' '
4e7677
+	test_when_finished "rm -rf dst" &&
4e7677
+	git clone --recurse-submodules . dst &&
4e7677
+	echo base >expect &&
4e7677
+	git -C dst/sub log -1 --format=%s >actual &&
4e7677
+	test_cmp expect actual
4e7677
+'
4e7677
+
4e7677
+test_expect_success 'remove ./ protection from .gitmodules url' '
4e7677
+	perl -i -pe "s{\./}{}" .gitmodules &&
4e7677
+	git commit -am "drop protection"
4e7677
+'
4e7677
+
4e7677
+test_expect_success 'clone rejects unprotected dash' '
4e7677
+	test_when_finished "rm -rf dst" &&
4e7677
+	test_must_fail git clone --recurse-submodules . dst 2>err &&
4e7677
+	test_i18ngrep ignoring err
4e7677
+'
4e7677
+
4e7677
+test_done
4e7677
diff -ruN git-2.9.3/t/t7417-submodule-path-url.sh git-2.9.3_patched/t/t7417-submodule-path-url.sh
4e7677
--- git-2.9.3/t/t7417-submodule-path-url.sh	1970-01-01 01:00:00.000000000 +0100
4e7677
+++ git-2.9.3_patched/t/t7417-submodule-path-url.sh	2018-10-24 17:13:59.893500178 +0200
4e7677
@@ -0,0 +1,20 @@
4e7677
+#!/bin/sh
4e7677
+
4e7677
+test_description='check handling of .gitmodule path with dash'
4e7677
+. ./test-lib.sh
4e7677
+
4e7677
+test_expect_success 'create submodule with dash in path' '
4e7677
+	git init upstream &&
4e7677
+	git -C upstream commit --allow-empty -m base &&
4e7677
+	git submodule add ./upstream sub &&
4e7677
+	git mv sub ./-sub &&
4e7677
+	git commit -m submodule
4e7677
+'
4e7677
+
4e7677
+test_expect_success 'clone rejects unprotected dash' '
4e7677
+	test_when_finished "rm -rf dst" &&
4e7677
+	test_might_fail git clone --recurse-submodules . dst 2>err &&
4e7677
+	test_i18ngrep ignoring err
4e7677
+'
4e7677
+
4e7677
+test_done