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
Philip Oakley <philipoakley@iee.org>
Date
Feb 22, 2017, 20:45 UTC
Message-ID
<F50FAF9C5F724A87B5424494262E1BAD@PhilipOakley>
In-Reply-To
<20170221231815.4123-1-sbeller@google.com>
From: "Stefan Beller" <sbeller@google.com>
Show 13 quoted lines
> 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.
>
> This can be confusing to users as there is a lot of guessing involved,
> which is not obvious to the user.

Would a note in the user docs about the fallback you list above also be useful?

Show 24 quoted lines
>
> So in the corner case of assuming a local autoritative truth, warn the
> user to lessen the confusion.
>
> This behavior was introduced in 4d6893200 (submodule add: allow relative
> repository path even when no url is set, 2011-06-06), which shared the
> code with submodule-init and then ported to C in 3604242f080a (submodule:
> port init from shell to C, 2016-04-15).
>
> In case of submodule-add, this behavior makes sense in some use cases[1],
> however for submodule-init there does not seem to be an immediate obvious
> use case to fall back to a local submodule. However there might be, so
> warn instead of die here.
>
> [1] e.g. 
> http://stackoverflow.com/questions/8721984/git-ignore-files-for-public-repository-but-not-for-private
> "store a secret locally in a submodule, with no intention to publish it"
>
> Reported-by: Shawn Pearce <spearce@spearce.org>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> builtin/submodule--helper.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>

-- Philip

Previous: Stefan BellerNext: Stefan Beller
Message 2 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.