git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] submodule init: warn about falling back to a local path

From
Stefan Beller <sbeller@google.com>
Date
Feb 24, 2017, 20:27 UTC
Message-ID
<CAGZ79kbzhHaV4-cVvqwodwXSBstRfH1FrOh=iYMvU6cqYUcUng@mail.gmail.com>
In-Reply-To
<xmqqlgsv1guq.fsf@gitster.mtv.corp.google.com>
On Fri, Feb 24, 2017 at 12:19 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> When a submodule is initialized, the config variable 'submodule.<name>.url'
>> is set depending on the value of the same variable in the .gitmodules
>> file. When the URL indicates to be relative, then the url is computed
>> relative to its default remote. The default remote cannot be determined
>> accurately in all cases, such that it falls back to 'origin'.
>>
>> The 'origin' remote may not exist, though. In that case we give up looking
>> for a suitable remote and we'll just assume it to be a local relative path.
>
> IOW we keep the .url to be relative, the same as the original one we
> took from .gitmodules?

Well that is one way to say that. Another way is: If we cannot construct a URL based on the given relative URL, we demote the relative URL to be a relative PATH and resolve that instead.

>  That sounds like a sensible thing to do and
> I agree it makes sense to warn when it happens.
ok.
Show 26 quoted lines
>
>> @@ -118,18 +122,22 @@ too (and can also report changes to a submodule's work tree).
>>
>>  init [--] [<path>...]::
>>       Initialize the submodules recorded in the index (which were
>> -     added and committed elsewhere) by copying submodule
>> -     names and urls from .gitmodules to .git/config.
>> -     Optional <path> arguments limit which submodules will be initialized.
>> -     It will also copy the value of `submodule.$name.update` into
>> -     .git/config.
>> -     The key used in .git/config is `submodule.$name.url`.
>> -     This command does not alter existing information in .git/config.
>> -     You can then customize the submodule clone URLs in .git/config
>> -     for your local setup and proceed to `git submodule update`;
>> -     you can also just use `git submodule update --init` without
>> -     the explicit 'init' step if you do not intend to customize
>> -     any submodule locations.
>> +     added and committed elsewhere) by copying `submodule.$name.url`
>> +     from .gitmodules to .git/config, resolving relative urls to be
>> +     relative to the default remote.
>
> I read this as "copying..., resolving relative to the default remote
> (if exists)."  A reader would wonder what happens if the default
> remote does not exist---don't we want to describe what happens in
> that case, like, "recording . (the current repository) as the
> upstream" or something?

eh, a better approach is s/copying/<something else>/ We will resolve the relative URL no matter what. It's just that we may end up with an absolute path instead of an absolute URL.

Show 6 quoted lines
>
>> ++
>> +Optional <path> arguments limit which submodules will be initialized.
>> +If no path is specified all submodules are initialized.
>
> Perhaps s/ all submodules/,&/?
ok
Will reroll, once I have found a better wording.
Previous: Junio C HamanoNext: Stefan Beller
Message 8 of 9 in “submodule init: warn about falling back to a local path”
  1. submodule init: warn about falling back to a local pathStefan Beller, Feb 21, 2017
  2. Philip OakleyFeb 22, 2017
  3. Stefan BellerFeb 23, 2017
  4. submodule init: warn about falling back to a local pathStefan Beller, Feb 24, 2017
  5. Johannes SixtFeb 24, 2017
  6. submodule init: warn about falling back to a local pathStefan Beller, Feb 24, 2017
  7. Junio C HamanoFeb 24, 2017
  8. Stefan BellerFeb 24, 2017
  9. submodule init: warn about falling back to a local pathStefan Beller, Feb 25, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.