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

Re: can anybody explain the following to a git noob?

From
Andreas Ericsson <ae@op5.se>
Date
May 22, 2009, 09:35 UTC
Message-ID
<4A1671E5.4030400@op5.se>
In-Reply-To
<855e4dcf0905212244r454a5c21w7bdbfb566a28efb8@mail.gmail.com>
Tim Uckun wrote:
Show 7 quoted lines
>>> *********Try to rename a directory  WTF?: Git thinks any directory with a
>>> .git folder is empty and refuses to rename the directory.
>> Well, why do other folders contain .git directories?
> 
> It just worked out that way.  I am experimenting with a rails app and
> those plugins were pulled from github.
> 
But not, I take it, as submodules?
Show 10 quoted lines
>>  Are they
>> *separate* git repositories?  If so, git doesn't know what to do with
>> them and leaves them alone.  (Well, in fact it treats them as
>> submodules.)
> 
> 
> yes they are separate repositories. I would be happy if it left them
> alone or treated them as submodules.  I was just puzzled as to why git
> thought they were empty when they were clearly not.
> 

Because from git's point of view, they were already managed in a separate repository as a submodule. When you have submodules in a repository, the parent repository can't (well, won't anyways) track files inside the submodule directory, so git ignores everything under a worktree subdirectory that contains a .git folder.

Show 9 quoted lines
>> All your other weird problems seem to come from this, as far as I can
>> tell.  If not, it would be helpful if you could give *complete*
>> reproduction steps for your problem.
> 
> Those were the complete steps. I did no other operations on the
> directory.  So the fact that the test directory is misbehaving is
> because a directory in the vendor hierarchy has a .git folder?
> 
> I'll have to clean up all those and see if the problem remains.

A better way is probably to import those projects as proper submodules so you can update them without hassle later. "git help submodule" should get you a long way, but be prepared to study the docs a little so you understand the caveats with submodules before you use them. For instance, you *will* run into problems if you later replace a worktree subdirectory belonging to the parent git repository with a submodule, so it's really better to have them as submodules from the start.

HTH
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Register now for Nordic Meet on Nagios, June 3-4 in Stockholm
 http://nordicmeetonnagios.op5.org/

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Previous: Tim UckunNext: Tim Uckun
Message 4 of 16 in “can anybody explain the following to a git noob?”
  1. Tim UckunMay 22, 2009
  2. Avery PennarunMay 22, 2009
  3. Tim UckunMay 22, 2009
  4. Andreas EricssonMay 22, 2009
  5. Tim UckunMay 22, 2009
  6. Johannes SixtMay 22, 2009
  7. Tim UckunMay 22, 2009
  8. Julian PhillipsMay 22, 2009
  9. Tim UckunMay 23, 2009
  10. Andreas EricssonMay 22, 2009
  11. Daniel BarkalowMay 22, 2009
  12. Tim UckunMay 23, 2009
  13. Heiko VoigtMay 25, 2009
  14. Tim UckunMay 25, 2009
  15. Sitaram ChamartyMay 22, 2009
  16. Dan LoewenherzMay 22, 2009

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.