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

Re: [BUG?] gitlink without .gitmodules no longer fails recursive clone

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 10, 2017, 11:12 UTC
Message-ID
<xmqqr2ys14h2.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170610071342.gdmpgjqlho2xfvdt@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 16 quoted lines
> Certainly I think it _could_ be a valid state. But traditionally it
> caused "clone --recursive" to barf. And from what Stefan and Brandon
> have said, we are moving in the opposite direction entirely, with
> .gitmodules becoming the source of truth.
> 
> I could see arguments for going in either direction (gitlinks versus
> .gitmodules as source of truth for submodules). But it bothers me that
> it's so easy to create a state that will behave in a confusing manner.
> ...
> Allowing both is not in itself wrong.  But because we provide no
> guidance for the expert route, it's easy to shoot yourself in the foot
> and not even realize it. Which is why I suggested a warning and not
> forbidding the operation. Or better still, an advise() block that tells
> you how to recover (probably "git submodule add", though it might need
> to learn to handle already-present gitlinks). And which can be disabled
> if you really are an expert user.

Yeah, the current situation is bad in that having both .gitmodules file and gitlinks in a tree allows for redundant pieces of information to go out of sync and result in contradiction. A gitlink without an entry in the .gitmodules file is an obvious example. An entry in .gitmodules file whose path does not have a gitlink in the tree would also be a broken case.

While "git submodule" was the only/primary interface to the submodule, it was rather easy to explain that ".gitmodules need to be consistent with the index and the tree iff you do 'git submodule' thing" (implying "if you only use gitlinks to bind two or more projects locally without sharing with others, you do not need 'git submodule' and you do not need .gitmodules"), but with the recent push to add "--recurse-submodules" to everything, the extent of what was historically "iff you do 'git submodule' thing" is getting larger and it becomes more and more important to keep .gitmodules consistent with gitlinks in the tree that house it.

I find it a bit sad, but I do not think of a better way X-<.
Previous: Jeff KingNext: Stefan Beller
Message 8 of 23 in “[BUG?] gitlink without .gitmodules no longer fails recursive clone”
  1. Jeff KingJun 6, 2017
  2. Stefan BellerJun 6, 2017
  3. Brandon WilliamsJun 6, 2017
  4. Jeff KingJun 6, 2017
  5. Jeff KingJun 9, 2017
  6. Junio C HamanoJun 10, 2017
  7. Jeff KingJun 10, 2017
  8. Junio C HamanoJun 10, 2017
  9. Stefan BellerJun 12, 2017
  10. Jeff KingJun 13, 2017
  11. 1/2 add: warn when adding an embedded repositoryJeff King, Jun 13, 2017
  12. Stefan BellerJun 13, 2017
  13. Brandon WilliamsJun 13, 2017
  14. Jeff KingJun 14, 2017
  15. 0/2 warn when adding an embedded repositoryJeff King, Jun 14, 2017
  16. 1/2 add: warn when adding an embedded repositoryJeff King, Jun 14, 2017
  17. 2/2 t: move "git add submodule" into test blocksJeff King, Jun 14, 2017
  18. Stefan BellerJun 14, 2017
  19. Jeff KingJun 15, 2017
  20. Junio C HamanoJun 13, 2017
  21. Jeff KingJun 14, 2017
  22. 2/2 t: move "git add submodule" into test blocksJeff King, Jun 13, 2017
  23. Stefan BellerJun 13, 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.