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

Re: [PATCH v4 2/3] implement fetching of moved submodules

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 19, 2017, 00:35 UTC
Message-ID
<xmqqwp3sj7ov.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAGZ79kaTXC9Eius3jMZGefZioJtS-uuf+ar5zt=WSEWQJxdcwQ@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
Show 11 quoted lines
>> but if we already have a submodule with that name (the most likely
>> explanation for its existence is because it started its life there
>> and then later moved), and the submodule is bound to a different
>> path, then that is a different submodule.  Skipping and warning both
>> are sensible thing to do.
>
> Skipping and warning is sensible once we decide to go this way.
>
> I propose to take a step back and not throw away the information
> whether the given string is a name or path, as then we do not have
> to warn&skip, but we can treat both correctly.

Now either one of us is utterly confused, and I suspect it is me, as I do not see how "treat both correctly" could possibly work in the case this code warns and skips.

At this point in the flow, we already know that it is not name, because we asked and got a "Nah, there is no submodule registered in .gitmodules at that path" from submodule_from_path(). Then we ask submodule_from_name() if there is any submodule registered under the name it would have got if it were added there, and we indeed find one. And that is definitely *not* a submodule we are looking for, because if it were, its .path would have pointed at the path we were using to ask in the first place. The one we originally found at path and are interested in finding out the details is not known to .gitmodules, and the one under that name is not the one that we are intereted in, so fetching from the repository the other one that happens to have the same name but is different from the submodule we are interested in would simply be wrong.

If we only have path without any .gitmodules entry (hence there is not even URL), how would we proceed from that point on?

Previous: Stefan BellerNext: Stefan Beller
Message 15 of 24 in “implement fetching of moved submodules”
  1. 0/3 implement fetching of moved submodulesHeiko Voigt, Oct 16, 2017
  2. 1/3 fetch: add test to make sure we stay backwards compatibleHeiko Voigt, Oct 16, 2017
  3. Stefan BellerOct 17, 2017
  4. 3/3 submodule: simplify decision tree whether to or not to fetchHeiko Voigt, Oct 16, 2017
  5. Stefan BellerOct 17, 2017
  6. Junio C HamanoOct 18, 2017
  7. Brandon WilliamsOct 18, 2017
  8. Junio C HamanoOct 19, 2017
  9. Heiko VoigtOct 19, 2017
  10. Brandon WilliamsOct 19, 2017
  11. 2/3 implement fetching of moved submodulesHeiko Voigt, Oct 16, 2017
  12. Stefan BellerOct 17, 2017
  13. Junio C HamanoOct 18, 2017
  14. Stefan BellerOct 18, 2017
  15. Junio C HamanoOct 19, 2017
  16. 1/2 t5526: check for name/path collision in submodule fetchStefan Beller, Oct 19, 2017
  17. 2/2 fetch, push: keep separate lists of submodules and gitlinksStefan Beller, Oct 19, 2017
  18. Heiko VoigtOct 23, 2017
  19. Stefan BellerOct 23, 2017
  20. Junio C HamanoOct 24, 2017
  21. Heiko VoigtOct 23, 2017
  22. Stefan BellerOct 23, 2017
  23. Stefan BellerOct 19, 2017
  24. Junio C HamanoOct 17, 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.