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

Re: Git Submodule Problem - Bug?

From
Jens Lehmann <jens.lehmann@web.de>
Date
Nov 29, 2011, 17:42 UTC
Message-ID
<4ED5196B.5030200@web.de>
In-Reply-To
<20111129104105.GA10839@kolya>
Am 29.11.2011 11:41, schrieb Fredrik Gustafsson:
Show 7 quoted lines
> On Tue, Nov 29, 2011 at 11:25:41AM +0100, Thomas Rast wrote:
>> So maybe the right questions to ask would be: what's the *official*
>> way of removing a submodule completely?  Do we support overwriting
>> submodules in the way Manuel wanted to?  Why not? :-)
> 
> I suggest that we add a command for that;
> git submodule remove <submodule>

Hmm, to me it looks like the problem is in "git submodule add". It doesn't check if the submodule repo it finds in .git/modules matches the one the user wants to create. So we end up reviving the first submodule although the user wants to use a completely different repo.

One solution could be to only let "git submodule update" revive submodules from .git/modules and make "git submodule add" error out if it finds the git directory of a submodule with the same name in .git/modules. But currently there is no way to tell "git submodule add" to use a different submodule name (it always uses the path as a name), so we might have to add an option to do that and tell the user in the error message how he can add a different submodule under the same path.

Another solution could be that "git submodule add" detects that a submodule with the name "sub" did exist and chooses a different name (say "sub2") for the the new one. Then the user wouldn't have to cope with the problem himself.

Previous: Fredrik GustafssonNext: Manuel Koller
Message 6 of 11 in “Git Submodule Problem - Bug?”
  1. Manuel KollerNov 28, 2011
  2. Thomas RastNov 29, 2011
  3. Fredrik GustafssonNov 29, 2011
  4. Thomas RastNov 29, 2011
  5. Fredrik GustafssonNov 29, 2011
  6. Jens LehmannNov 29, 2011
  7. Manuel KollerNov 29, 2011
  8. Junio C HamanoNov 29, 2011
  9. Heiko VoigtNov 29, 2011
  10. Manuel KollerDec 7, 2011
  11. Jens LehmannDec 7, 2011

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.