Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-04-25 03:57:47 +0300
committerJunio C Hamano <gitster@pobox.com>2017-04-25 05:00:15 +0300
commit627fde102515a7807dba89acaa88cb053b38a44a (patch)
tree3a255ca92f07db454e523baff730b18941eae6a8 /t/t7400-submodule-basic.sh
parent0202c411edc25940cc381bf317badcdf67670be4 (diff)
submodule_init: die cleanly on submodules without url defined
When we init a submodule, we try to die when it has no URL defined: url = xstrdup(sub->url); if (!url) die(...); But that's clearly nonsense. xstrdup() will never return NULL, and if sub->url is NULL, we'll segfault. These two bits of code need to be flipped, so we check sub->url before looking at it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7400-submodule-basic.sh')
-rwxr-xr-xt/t7400-submodule-basic.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 3570f7bb8c..01e25a44c7 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -38,6 +38,14 @@ test_expect_success 'submodule update aborts on missing .gitmodules file' '
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 &&