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

Re: Why does 'submodule add' stage the relevant portions?

From
Jens Lehmann <jens.lehmann@web.de>
Date
Mar 26, 2013, 16:57 UTC
Message-ID
<5151D37A.6000708@web.de>
In-Reply-To
<CALkWK0mXOHGJHQ85mMuoUyzti6b2QoijN1EEFzpJ+TKm3tWnXg@mail.gmail.com>
Am 26.03.2013 08:57, schrieb Ramkumar Ramachandra:
Show 11 quoted lines
> Jens Lehmann wrote:
>> And leaving aside 'add', there are tons of submodules out there
>> which were cloned with older Git who have their .git directory
>> inside the work tree. So a new subcommand (or at least a helper
>> script in contrib) to relocate the .git directory would really help
>> here to migrate these legacy submodules without users having to
>> worry about data loss.
> 
> The question is: after using a "non-relocated submodule" for some
> time, will the user suddenly decide to make it a "relocated submodule"
> one day?

I think quite some users - and definitely myself - will do that as soon as the full recursive checkout materialized, as that allows to remove submodules without any directory remaining and even to replace a submodule with a directory containing other files. And even with current Git you already get a clean work tree when using "git rm" or "git submodule deinit" (in current master) on a submodule iff it has its .git directory stored in the .git directory of the superproject. It is definitely not a Must Have right now, but I expect it to be that in the near future.

Show 11 quoted lines
>>> I meant a variant of add that would clone, but not stage.  I was
>>> arguing for a new subcommand so that I don't have to touch 'submodule
>>> add', not for a rename.
>>
>> Ah, now I get it, I was confused by your reference to 'git submodule
>> add <repository> <path>'. I have to admit I still don't understand
>> the use case you have for adding a submodule without staging it, but
>> maybe it is just too late here.
> 
> I usually reset after running 'git submodule add', because I rarely
> commit the added submodule immediately after adding it.

I'm not sure many submodule users do the same, but even then the normal ways of unstaging the submodule and .gitmodules should be sufficient here, no? I'd rather avoid adding a new command to git submodule for that.

Previous: Ramkumar RamachandraNext: Junio C Hamano
Message 8 of 18 in “Why does 'submodule add' stage the relevant portions?”
  1. Ramkumar RamachandraMar 24, 2013
  2. Jens LehmannMar 25, 2013
  3. Ramkumar RamachandraMar 25, 2013
  4. Jens LehmannMar 25, 2013
  5. Ramkumar RamachandraMar 25, 2013
  6. Jens LehmannMar 25, 2013
  7. Ramkumar RamachandraMar 26, 2013
  8. Jens LehmannMar 26, 2013
  9. Junio C HamanoMar 25, 2013
  10. Ramkumar RamachandraMar 25, 2013
  11. Jonathan NiederMar 25, 2013
  12. Ramkumar RamachandraMar 25, 2013
  13. Junio C HamanoMar 25, 2013
  14. Ramkumar RamachandraMar 25, 2013
  15. Jonathan NiederMar 25, 2013
  16. Ramkumar RamachandraMar 25, 2013
  17. Jonathan NiederMar 25, 2013
  18. Duy NguyenMar 26, 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.