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

Re: Git Submodule Problem - Bug?

From
MKManuel Koller <koller.manuel@gmail.com>
Date
Nov 29, 2011, 18:15 UTC
Message-ID
<839E634E-76C0-40ED-8CCC-43E52F782079@gmail.com>
In-Reply-To
<4ED5196B.5030200@web.de>
Thanks for taking my problem seriously.
On 29.11.2011, at 18:42, Jens Lehmann wrote:
Show 13 quoted lines
> Am 29.11.2011 11:41, schrieb Fredrik Gustafsson:
>> 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.
In have wrote a workaround for the problem i posted that goes into this direction. I just check whether the url has changed and remove the submodule by hand if it did. See https://github.com/kollerma/git-submodule-tools if you're interested (its in git-fix-submodules).
Show 13 quoted lines
> 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.
What is the purpose of having two different submodules in the same path? Identifying the submodule by url however would probably make things considerably faster. At least in my case, since I have checked out different branches of the same repo at different paths as submodules. 
Previous: Jens LehmannNext: Junio C Hamano
Message 7 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.