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

Problem with multiples levels of submodules

From
JØJeppe Øland <joland@gmail.com>
Date
Jun 25, 2024, 22:54 UTC
Message-ID
<CA+osTZWaDpH_ZcEhHKrzcaWmHjTAiiWfPmf6C9u3NnzmY0PghQ@mail.gmail.com>
Hi there,

I'm seeing a strange thing with multi-level submodules. Not sure what's going on, but it feels like a bug. (I'm doing this on git "2.45.2.windows.1").

For a while, I've been globally setting the recursive and active config options:
    git config --global submodule.recurse true
    git config --global submodule.active .
This has the benefit that I don't need to "git submodule init" new
modules since everything is active.
The weirdness happens when there are submodules within a submodule.
I can reproduce it by just creating 3 git repositories (I have only
tried with GH hosted repos, maybe its different if done locally).
Each repo has a directory within it, and that directory is a submodule
of the next one.
    top -> middle -> bottom
Now, if I don't set the global config above, I can:
    "git clone --recurse-submodules <PATH>" to get everything.
Or:
    "git clone <PATH>", "cd", "git submodule init", "git pull" etc. to
again get everything.
But if I set the global options, I can do:
    "git clone <PATH>" to clone the top level.
    "cd top" to go in there.
    "git pull" to update everything, including submodules.
But while cloning "middle", it gives me an error:
    fatal: not a git repository: ../../.git/modules/middle/modules/bottom
Something is getting confused and thinks there are worktrees involved:
    ".git/modules/middle/config" has "worktree" line in the [core]
section (this appears to be normal).
    ".git/modules/middle/modules/bottom/config" is not a repository,
but just a "[core] worktree" section (definitely not normal).
This all works fine if there is only one level of submodules (top->middle).
Any ideas?

Regards, -Jeppe

Next: Jeppe Øland
Message 1 of 2 in “Problem with multiples levels of submodules”
  1. Jeppe ØlandJun 25, 2024
  2. Jeppe ØlandJul 2, 2024

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.