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

Re: Fwd: Uninit'ed submodules

From
Jens Lehmann <jens.lehmann@web.de>
Date
May 6, 2013, 19:16 UTC
Message-ID
<51880191.2070809@web.de>
In-Reply-To
<CAFOYHZDKTYFNRHUwdas7kZKs8UbdrY=hAA0SVqbz48NjWsHKww@mail.gmail.com>
Am 06.05.2013 02:19, schrieb Chris Packham:
Show 12 quoted lines
> This did get me thinking. Why does an uninitialized submodule need to
> have an empty directory? If it didn't the maintainer in question
> probably would have realized that he needed to run "git submodule
> update --init" when his "cd submodule" command failed.
> 
> I'm guessing there is a good reason for the empty directory - perhaps
> so that git can notice the fact that it exists in the worktree but is
> out of date?  If it does need to have some presence in the worktree
> why not as a file? That way the cd command would still fail (albeit
> with a different error) providing the necessary indication to the
> user. The submodule update --init could then change from file -> dir
> when it actually gets populated.

Hmm, to me an empty directory is the natural representation of an unpopulated submodule, but I see why that made it hard for your maintainer to notice the fact that the submodule was uninitialized. I suspect changing an unpopulated submodule to be represented by a file will surprise quite some users (some of which will probably come up with perfectly valid use cases such a change will break).

What about the following: Today's Git completely ignores empty submodule directories, but I think that when the recursive checkout support is there, the "submodule.autoupdate" flag - which I believe should control that behavior - could also make those empty submodule directories show up in "git status" as being unpopulated (after all they are configured to be updated automatically, so not having them populated is something Git should show). Would something like this have helped here?

Until then I can only propose to establish a best practice of using "git clone --recurse-submodules" in these situations to avoid the problem you described.

Previous: Chris PackhamNext: Chris Packham
Message 2 of 3 in “Fwd: Uninit'ed submodules”
  1. Chris PackhamMay 6, 2013
  2. Jens LehmannMay 6, 2013
  3. Chris PackhamMay 7, 2013

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.