Merge branch 'sb/submodule-init-url-selection'

When "git submodule init" decides that the submodule in the working
tree is its upstream, it now gives a warning as it is not a very
common setup.

* sb/submodule-init-url-selection:
  submodule init: warn about falling back to a local path
This commit is contained in:
Junio C Hamano
2017-03-10 13:24:24 -08:00
2 changed files with 27 additions and 19 deletions

View File

@ -356,12 +356,10 @@ static void init_submodule(const char *path, const char *prefix, int quiet)
strbuf_addf(&remotesb, "remote.%s.url", remote);
free(remote);
if (git_config_get_string(remotesb.buf, &remoteurl))
/*
* The repository is its own
* authoritative upstream
*/
if (git_config_get_string(remotesb.buf, &remoteurl)) {
warning(_("could not lookup configuration '%s'. Assuming this repository is its own authoritative upstream."), remotesb.buf);
remoteurl = xgetcwd();
}
relurl = relative_url(remoteurl, url, NULL);
strbuf_release(&remotesb);
free(remoteurl);