summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-05-01 05:14:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-01 05:14:44 (GMT)
commitd92dbf1934faad614c31482446d5f32fb9322470 (patch)
treef47557d9a01abea4b8a799854c0cc5551be11373 /builtin
parentb0f89870ea54b86fb7935f90605d329533849b33 (diff)
parent627fde102515a7807dba89acaa88cb053b38a44a (diff)
downloadgit-d92dbf1934faad614c31482446d5f32fb9322470.zip
git-d92dbf1934faad614c31482446d5f32fb9322470.tar.gz
git-d92dbf1934faad614c31482446d5f32fb9322470.tar.bz2
Merge branch 'jk/submodule-init-segv-fix'
Fix a segv in 'submodule init' when url is not given for a submodule. * jk/submodule-init-segv-fix: submodule_init: die cleanly on submodules without url defined
Diffstat (limited to 'builtin')
-rw-r--r--builtin/submodule--helper.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 36e4231..566a5b6 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -376,12 +376,12 @@ static void init_submodule(const char *path, const char *prefix, int quiet)
strbuf_reset(&sb);
strbuf_addf(&sb, "submodule.%s.url", sub->name);
if (git_config_get_string(sb.buf, &url)) {
- url = xstrdup(sub->url);
-
- if (!url)
+ if (!sub->url)
die(_("No url found for submodule path '%s' in .gitmodules"),
displaypath);
+ url = xstrdup(sub->url);
+
/* Possibly a url relative to parent */
if (starts_with_dot_dot_slash(url) ||
starts_with_dot_slash(url)) {