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

Re: url.<base>.insteadOf vs. submodules

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 21, 2017, 23:59 UTC
Message-ID
<xmqqk28jdrih.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqo9xvdsji.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 7 quoted lines
> So I would think it is entirely reasonable if "git submodule init
> sub" that is run in the superproject to initialize "sub" writes
> something in "sub/.git" to tell that "sub" is used in the context of
> that particular toplevel superproject and customize its behavour
> accordingly.  Perhaps it may want to add the url.*.insteadOf that is
> useful for updating the submodule repository when it does "submodule
> init", for example.

Of course, "copying" is usually not very desirable, as it invites one of the copies to go stale. An actual implementation may just say "the name of submodule the superproject uses this as is 'foo'".

That way, if such a configuration exists, Git can first do cd-up to the root of the working tree, go one level up, verify that it is in a worktree of its superproject, verify that the root of the working tree it came from was indeed bound to the submodule called 'foo' and then do the selective/filtered "config-include" Peff outlined. That would allow superproject to move submodules around (as opposed to recording "this submodule is used at this/path of the superproject" or "the superproject of this submodule is at ../../that/path"), and does not penalize repositories that are not used as submodules of any superproject (because the "cd-up, up, verify and include" won't be done for them). As opposed to "I am used as a submodule" bit, recording the name the superproject uses to call the submodule would also serve as a sanity check measure.

Previous: Junio C HamanoNext: Stefan Beller
Message 11 of 19 in “url.<base>.insteadOf vs. submodules”
  1. ToolforgerFeb 19, 2017
  2. Jeff KingFeb 20, 2017
  3. ToolforgerFeb 20, 2017
  4. Jeff KingFeb 20, 2017
  5. ToolforgerFeb 21, 2017
  6. Jeff KingFeb 21, 2017
  7. Stefan BellerFeb 21, 2017
  8. Jeff KingFeb 21, 2017
  9. Stefan BellerFeb 21, 2017
  10. Junio C HamanoFeb 21, 2017
  11. Junio C HamanoFeb 21, 2017
  12. Stefan BellerFeb 22, 2017
  13. Junio C HamanoFeb 22, 2017
  14. Jon LoeligerFeb 22, 2017
  15. Junio C HamanoFeb 22, 2017
  16. Jeff KingFeb 22, 2017
  17. Stefan BellerFeb 22, 2017
  18. Jeff KingFeb 21, 2017
  19. Stefan BellerFeb 22, 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.