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

Init of submodule within subtree not working

From
TKThomas Kitzinger <th.kitzinger@gmail.com>
Date
Mar 13, 2019, 15:06 UTC
Message-ID
<CALYpq6_n_5kf5gFwki8cuUW=xSB80L4uoicSOL40OnohK1+h0Q@mail.gmail.com>
 Hello,

currently I’m having trouble using subtree to include a subproject that itself contains submodules.

$ git subtree add --prefix folderB/subtreeproject https:\\xx master --squash
The resulting structure is something like the following:
superproject/
├── .git/
├── .gitmodules
└── folderA/
    ├── someFileA
    └── submoduleA /
└── folderB/
    ├── someFileB
    └── subtreeproject/   <= THE SUBTREE
        ├── .gitmodules
        ├── someFolder/
        └── submoduleInSubtree/   <= THE SUBMODULE IN SUBTREE
The subtreeproject contains its own submodule and therefore its own .gitmodules.

If I now run $ git submodule update --init --remote I get the error fatal: No url found for submodule path ‘folderB/subtreeproject/submoduleInSubtree’ in .gitmodules

The only way I could get the submodule initialized is by manually copying the contents of the folder/subtreeproject/.gitmodules to the top-level .gitmodules and adjusting the path accordingly, which is quite annoying.

Is this behavior intended? Isn’t there a more elegant solution?

Couldn’t git respect .gitmodules not only in the root directory but also in any sub-directory? I learned it already works for submodules within other submodules, but apparently not for submodules within subtrees.

My git version: $ git version 2.21.0.windows.1

Best regards
Thomas Kitzinger
Message 1 of 1 in “Init of submodule within subtree not working”
  1. Thomas KitzingerMar 13, 2019

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.