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

Re: question about git-submodule

From
ETEran Tromer <git2eran@tromer.org>
Date
Aug 6, 2007, 17:23 UTC
Message-ID
<46B75907.1070007@tromer.org>
In-Reply-To
<20070805145922.GC999MdfPADPa@greensroom.kotnet.org>
On 2007-08-05 10:59, Sven Verdoolaege wrote:
Show 9 quoted lines
>> BTW, is there any easy way to create a submodule directly inside the
>> supermodule's working tree, instead of cloning it as in the above example?
> 
> Do you want to use the submodule porcelain or just the plumbing?
> If you simply want to add a submodule locally, "git add" will do that for
> you just fine.  It's only when you want to make it easier for people who
> clone your superproject to get updates of the submodules that you
> should set up the information required by "git submodule" in .gitmodules
> (see end of module_add in git-submodule.sh).
If you just do "git add sub" (where sub is an existing repo subdir) then
any subsequent "git submodule update" predictably complains:
  No submodule mapping found in .gitmodules for path 'sub'

And if you wire up .gitmodules manually, then "git submodule update" chokes on the "git-fetch" in modules_update().

So I suggest extending "git submodule add" to handle existing subdirectories by simply using them as-is instead of creating a new clone. And "git submodule update" shouldn't try fetching when the commit is already present locally.

Speaking of which, currently "git submodule" clones/fetches *all* branches on the remote repository, which seems quite excessive given that the supermodule's content references just one submodule commit. By default, "git submodule add" should fetch only the needed head, and "git submodule update" should fetch only the commit sha1 (if needed).

  Eran
Previous: Sven Verdoolaege
Message 22 of 22 in “question about git-submodule”
  1. VMiklosJul 13, 2007
  2. Sven VerdoolaegeJul 15, 2007
  3. Alex RiesenJul 15, 2007
  4. VMiklosJul 15, 2007
  5. Alex RiesenJul 15, 2007
  6. VMiklosJul 15, 2007
  7. Sven VerdoolaegeJul 15, 2007
  8. VMiklosJul 15, 2007
  9. Sven VerdoolaegeJul 15, 2007
  10. VMiklosJul 15, 2007
  11. Sven VerdoolaegeJul 15, 2007
  12. VMiklosJul 15, 2007
  13. Sven VerdoolaegeJul 15, 2007
  14. VMiklosJul 15, 2007
  15. Sven VerdoolaegeJul 16, 2007
  16. VMiklosJul 16, 2007
  17. Sven VerdoolaegeJul 15, 2007
  18. Alex RiesenJul 15, 2007
  19. Sven VerdoolaegeJul 15, 2007
  20. Eran TromerAug 3, 2007
  21. Sven VerdoolaegeAug 5, 2007
  22. Eran TromerAug 6, 2007

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.