{"thread":{"id":"19437","subject":"can anybody explain the following to a git noob?","startedAt":"2009-05-22T03:46:08Z","lastAt":"2009-05-25T12:52:29Z","messageCount":16,"participants":["Tim Uckun","Avery Pennarun","Andreas Ericsson","Johannes Sixt","Sitaram Chamarty","Julian Phillips","Dan Loewenherz","Daniel Barkalow","Heiko Voigt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"114446","messageId":"855e4dcf0905212046o3e1d6ec6l487829a0a411dcaf@mail.gmail.com","threadId":"19437","inReplyTo":null,"subject":"can anybody explain the following to a git noob?","fromName":"Tim Uckun","fromEmail":"timuckun@gmail.com","sentAt":"2009-05-22T03:46:08Z","receivedAt":"2009-05-22T03:46:08Z","isPatch":false,"sender":{"key":"timuckun@gmail.com","avatar":"https://gravatar.com/avatar/86579dfb796bcf3aa7743316c31dc724afc0f0fcd65890b69aee52ee4d9e2dc3?d=mp&s=160"},"body":"A transcript...\n\ngit init\ngit add . > /dev/nul\ngit commit -m 'initial import'\n\ngit status\n# On branch master\nnothing to commit (working directory clean)\n\n***** Create new branch  ********\ngit checkout -b my_branch\nSwitched to a new branch \"my_branch\"\n\n*********Try to rename a directory  WTF?: Git thinks any directory with a\n.git folder is empty and refuses to rename the directory.\ngit mv vendor vendor_new\nfatal: source directory is empty, source=vendor/plugins/acts_as_audited,\ndestination=vendor_new/plugins/acts_as_audited\n\nls vendor/plugins/acts_as_audited/\nCHANGELOG  generators  init.rb  lib  LICENSE  Rakefile  README  spec  tasks\ntest.txt\n\n******** Initial state of the test directory\nls test\nfixtures  functional  integration  mocks  test_helper.rb  unit  watir\n\n****** Rename and commit changes\ngit mv test test_new\ngit commit -m 'renamed the test directory'\n\n********Current state of the directory\n ls\napp  Capfile  config  db  doc  lib  MyProject.kpf  public  Rakefile  README\nscript  test_new  tmp  vendor\n\n\n********Checkout master. WTF?: Both the test and the test_new directories\nexist. Why does the test_new exist in this branch?\ngit checkout master\nls\napp  Capfile  config  db  doc  lib  MyProject.kpf  public  Rakefile  README\nscript  test  test_new  tmp  vendor\n\n******** list  the test directory.  WTF?: Where did the mocks subdir go??\n(see above for the initial directory listing)\n ls test\nfixtures  functional  integration  test_helper.rb  unit  watir\n\n**** Check the test_new directory:  WTF?: Where are all the other\nsubdirectories?\nls test_new\nfunctional  mocks\n\n******** Merge  Everything is merged properly.\ngit merge my_branch\n\nls\napp  Capfile  config  db  doc  lib  MyProject.kpf  public  Rakefile  README\nscript  test_new  tmp  vendor\nls test_new\nfixtures  functional  integration  mocks  test_helper.rb  unit  watir\n\n\nobviously I am doing something profoundly wrong. Can somebody explain why\nthis is happening?\n"},{"id":"114447","messageId":"32541b130905212202q9aed54cn892171b7e654812f@mail.gmail.com","threadId":"19437","inReplyTo":"855e4dcf0905212046o3e1d6ec6l487829a0a411dcaf@mail.gmail.com","subject":"Re: can anybody explain the following to a git noob?","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2009-05-22T05:02:55Z","receivedAt":"2009-05-22T05:02:55Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Thu, May 21, 2009 at 11:46 PM, Tim Uckun <timuckun@gmail.com> wrote:\n> A transcript...\n>\n> git init\n> git add . > /dev/nul\n> git commit -m 'initial import'\n\n...okay...\n\n> *********Try to rename a directory  WTF?: Git thinks any directory with a\n> .git folder is empty and refuses to rename the directory.\n\nWell, why do other folders contain .git directories?  Are they\n*separate* git repositories?  If so, git doesn't know what to do with\nthem and leaves them alone.  (Well, in fact it treats them as\nsubmodules.)\n\nAll your other weird problems seem to come from this, as far as I can\ntell.  If not, it would be helpful if you could give *complete*\nreproduction steps for your problem.\n\nHave fun,\n\nAvery\n"},{"id":"114448","messageId":"855e4dcf0905212244r454a5c21w7bdbfb566a28efb8@mail.gmail.com","threadId":"19437","inReplyTo":"32541b130905212202q9aed54cn892171b7e654812f@mail.gmail.com","subject":"Re: can anybody explain the following to a git noob?","fromName":"Tim Uckun","fromEmail":"timuckun@gmail.com","sentAt":"2009-05-22T05:44:48Z","receivedAt":"2009-05-22T05:44:48Z","isPatch":false,"sender":{"key":"timuckun@gmail.com","avatar":"https://gravatar.com/avatar/86579dfb796bcf3aa7743316c31dc724afc0f0fcd65890b69aee52ee4d9e2dc3?d=mp&s=160"},"body":">> *********Try to rename a directory  WTF?: Git thinks any directory with a\n>> .git folder is empty and refuses to rename the directory.\n>\n> Well, why do other folders contain .git directories?\n\nIt just worked out that way.  I am experimenting with a rails app and\nthose plugins were pulled from github.\n\n>  Are they\n> *separate* git repositories?  If so, git doesn't know what to do with\n> them and leaves them alone.  (Well, in fact it treats them as\n> submodules.)\n\n\nyes they are separate repositories. I would be happy if it left them\nalone or treated them as submodules.  I was just puzzled as to why git\nthought they were empty when they were clearly not.\n\n> All your other weird problems seem to come from this, as far as I can\n> tell.  If not, it would be helpful if you could give *complete*\n> reproduction steps for your problem.\n\nThose were the complete steps. I did no other operations on the\ndirectory.  So the fact that the test directory is misbehaving is\nbecause a directory in the vendor hierarchy has a .git folder?\n\nI'll have to clean up all those and see if the problem remains.\n"},{"id":"114457","messageId":"4A1671E5.4030400@op5.se","threadId":"19437","inReplyTo":"855e4dcf0905212244r454a5c21w7bdbfb566a28efb8@mail.gmail.com","subject":"Re: can anybody explain the following to a git noob?","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2009-05-22T09:35:33Z","receivedAt":"2009-05-22T09:35:33Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Tim Uckun wrote:\n>>> *********Try to rename a directory  WTF?: Git thinks any directory with a\n>>> .git folder is empty and refuses to rename the directory.\n>> Well, why do other folders contain .git directories?\n> \n> It just worked out that way.  I am experimenting with a rails app and\n> those plugins were pulled from github.\n> \n\nBut not, I take it, as submodules?\n\n>>  Are they\n>> *separate* git repositories?  If so, git doesn't know what to do with\n>> them and leaves them alone.  (Well, in fact it treats them as\n>> submodules.)\n> \n> \n> yes they are separate repositories. I would be happy if it left them\n> alone or treated them as submodules.  I was just puzzled as to why git\n> thought they were empty when they were clearly not.\n> \n\nBecause from git's point of view, they were already managed in a\nseparate repository as a submodule. When you have submodules in a\nrepository, the parent repository can't (well, won't anyways) track\nfiles inside the submodule directory, so git ignores everything under\na worktree subdirectory that contains a .git folder.\n\n>> All your other weird problems seem to come from this, as far as I can\n>> tell.  If not, it would be helpful if you could give *complete*\n>> reproduction steps for your problem.\n> \n> Those were the complete steps. I did no other operations on the\n> directory.  So the fact that the test directory is misbehaving is\n> because a directory in the vendor hierarchy has a .git folder?\n> \n> I'll have to clean up all those and see if the problem remains.\n\nA better way is probably to import those projects as proper\nsubmodules so you can update them without hassle later. \"git help\nsubmodule\" should get you a long way, but be prepared to study the\ndocs a little so you understand the caveats with submodules before\nyou use them. For instance, you *will* run into problems if you\nlater replace a worktree subdirectory belonging to the parent git\nrepository with a submodule, so it's really better to have them as\nsubmodules from the start.\n\nHTH\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n\nRegister now for Nordic Meet on Nagios, June 3-4 in Stockholm\n http://nordicmeetonnagios.op5.org/\n\nConsidering the successes of the wars on alcohol, poverty, drugs and\nterror, I think we should give some serious thought to declaring war\non peace.\n"},{"id":"114458","messageId":"855e4dcf0905220335n367a065fidc65567119c0a5a3@mail.gmail.com","threadId":"19437","inReplyTo":"4A1671E5.4030400@op5.se","subject":"Re: can anybody explain the following to a git noob?","fromName":"Tim Uckun","fromEmail":"timuckun@gmail.com","sentAt":"2009-05-22T10:35:57Z","receivedAt":"2009-05-22T10:35:57Z","isPatch":false,"sender":{"key":"timuckun@gmail.com","avatar":"https://gravatar.com/avatar/86579dfb796bcf3aa7743316c31dc724afc0f0fcd65890b69aee52ee4d9e2dc3?d=mp&s=160"},"body":">> It just worked out that way.  I am experimenting with a rails app and\n>> those plugins were pulled from github.\n>>\n>\n> But not, I take it, as submodules?\n>\n\nThat's right.\n\n\n>\n> Because from git's point of view, they were already managed in a\n> separate repository as a submodule. When you have submodules in a\n> repository, the parent repository can't (well, won't anyways) track\n> files inside the submodule directory, so git ignores everything under\n> a worktree subdirectory that contains a .git folder.\n\nI deleted the .git directory in that subfolder but I got the exact\nsame message. There was a .gitignore file in there so I deleted that\ntoo and still got the same message.    I think since the initial\ncheckin has the .git folder in it git has already decided it's not\ngoing to track it.\n\nAnyway as you can see from my original post I decided to mv the 'test'\ndirectory instead because it has no .git directory in it.\n\n>\n\n>>\n>> I'll have to clean up all those and see if the problem remains.\n>\n> A better way is probably to import those projects as proper\n> submodules so you can update them without hassle later. \"git help\n> submodule\" should get you a long way, but be prepared to study the\n> docs a little so you understand the caveats with submodules before\n> you use them. For instance, you *will* run into problems if you\n> later replace a worktree subdirectory belonging to the parent git\n> repository with a submodule, so it's really better to have them as\n> submodules from the start.\n>\n\nTo be honest I am just trying to learn the basics now and would rather\nget comfortable with those before I mess around with submodules.\n\nI still don't have an answer as to why the renamed test_new directory\nexists master branch and why both the original 'test' directory and\nthe renamed 'test_new' directory are missing subdirectories.\n\nUntil I understand that I won't feel comfortable using git.\n"},{"id":"114459","messageId":"4A16822A.2060404@viscovery.net","threadId":"19437","inReplyTo":"855e4dcf0905220335n367a065fidc65567119c0a5a3@mail.gmail.com","subject":"Re: can anybody explain the following to a git noob?","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-05-22T10:44:58Z","receivedAt":"2009-05-22T10:44:58Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Tim Uckun schrieb:\n> I still don't have an answer as to why the renamed test_new directory\n> exists master branch and why both the original 'test' directory and\n> the renamed 'test_new' directory are missing subdirectories.\n\nDid test_new contain ignored files? In this case, when you checkout the\nbranch that does not have test_new, only the tracked files are removed;\nthe ignored (i.e untracked) files remain. Therefore, after the checkout\nyou still have a test_new directory.\n\n-- Hannes\n"},{"id":"114461","messageId":"slrnh1d1k1.17t.sitaramc@sitaramc.homelinux.net","threadId":"19437","inReplyTo":"855e4dcf0905212244r454a5c21w7bdbfb566a28efb8@mail.gmail.com","subject":"Re: can anybody explain the following to a git noob?","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2009-05-22T11:03:29Z","receivedAt":"2009-05-22T11:03:29Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2009-05-22, Tim Uckun <timuckun@gmail.com> wrote:\n\n> directory.  So the fact that the test directory is misbehaving is\n> because a directory in the vendor hierarchy has a .git folder?\n>\n> I'll have to clean up all those and see if the problem remains.\n\nI believe those look like submodule directories to git,\nwhich are handled quite differently.\n\nman git-submodule maybe a good starting point\n"},{"id":"114463","messageId":"855e4dcf0905220436h1b6fa632q7804c98bf09b324c@mail.gmail.com","threadId":"19437","inReplyTo":"4A16822A.2060404@viscovery.net","subject":"Re: can anybody explain the following to a git noob?","fromName":"Tim Uckun","fromEmail":"timuckun@gmail.com","sentAt":"2009-05-22T11:36:01Z","receivedAt":"2009-05-22T11:36:01Z","isPatch":false,"sender":{"key":"timuckun@gmail.com","avatar":"https://gravatar.com/avatar/86579dfb796bcf3aa7743316c31dc724afc0f0fcd65890b69aee52ee4d9e2dc3?d=mp&s=160"},"body":">\n> Did test_new contain ignored files?\n\nNo.  I put the entire transcript in the first email. I did not tell\ngit to ignore anything and there were no .git directories in the test\nfolder.\n\n> In this case, when you checkout the\n> branch that does not have test_new, only the tracked files are removed;\n> the ignored (i.e untracked) files remain. Therefore, after the checkout\n> you still have a test_new directory.\n>\n\nAs far as I can tell all the files are tracked after I do a commit.\n\nI can understand why it put the original test directory back when I\nchanged to the master branch but I don't understand why it's missing a\nsubdirectory.  I don't think the test_new directory should be in the\nmaster branch at all but I guess I can kind of sort of see why git\nmight not remove it. What I can't understand at all is why it's\nmissing subdirectories.\n\nI hate to say this but I tried the exact same thing with mercurial in\nthe last half hour and it did exactly what I thought it should do. The\nmaster had the test directory but not the test_new and the branch had\nthe test_new directory but not the test. No subdirectories were\nmissing out of either one.\n"},{"id":"114464","messageId":"alpine.LNX.2.00.0905221259330.27232@reaper.quantumfyre.co.uk","threadId":"19437","inReplyTo":"855e4dcf0905220436h1b6fa632q7804c98bf09b324c@mail.gmail.com","subject":"Re: can anybody explain the following to a git noob?","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2009-05-22T12:04:13Z","receivedAt":"2009-05-22T12:04:13Z","isPatch":false,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Fri, 22 May 2009, Tim Uckun wrote:\n\n>>\n>> Did test_new contain ignored files?\n>\n> No.  I put the entire transcript in the first email. I did not tell\n> git to ignore anything and there were no .git directories in the test\n> folder.\n>\n>> In this case, when you checkout the\n>> branch that does not have test_new, only the tracked files are removed;\n>> the ignored (i.e untracked) files remain. Therefore, after the checkout\n>> you still have a test_new directory.\n>>\n>\n> As far as I can tell all the files are tracked after I do a commit.\n>\n> I can understand why it put the original test directory back when I\n> changed to the master branch but I don't understand why it's missing a\n> subdirectory.  I don't think the test_new directory should be in the\n> master branch at all but I guess I can kind of sort of see why git\n> might not remove it. What I can't understand at all is why it's\n> missing subdirectories.\n\nWhat's in the subdirectory?  Is it empty?  If so, that would explain what \nyou are seeing.  Git doesn't track directories - so an empty directory is \nalways treated as an untracked file.\n\n> I hate to say this but I tried the exact same thing with mercurial in\n> the last half hour and it did exactly what I thought it should do. The\n> master had the test directory but not the test_new and the branch had\n> the test_new directory but not the test. No subdirectories were\n> missing out of either one.\n\nI don't know if mercurial tracks directories, if it does, then this would \nexplain why it behaves diffently to git.\n\n-- \nJulian\n\n  ---\nEven a cabbage may look at a king.\n"},{"id":"114465","messageId":"4A169902.4070902@op5.se","threadId":"19437","inReplyTo":"855e4dcf0905220436h1b6fa632q7804c98bf09b324c@mail.gmail.com","subject":"Re: can anybody explain the following to a git noob?","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2009-05-22T12:22:26Z","receivedAt":"2009-05-22T12:22:26Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Tim Uckun wrote:\n>> Did test_new contain ignored files?\n> \n> No.  I put the entire transcript in the first email.\n\nNo you did not. You used 'ls' where you should have used 'ls -a' to also\nshow the \"hidden\" directory entries (.gitignore and .git)\n\n> I did not tell\n> git to ignore anything and there were no .git directories in the test\n> folder.\n> \n\nBut the upstream project could well have told git to ignore stuff, and\nsince .gitignore files are transmitted on clone they would have been\nsent along to you.\n\n>> In this case, when you checkout the\n>> branch that does not have test_new, only the tracked files are removed;\n>> the ignored (i.e untracked) files remain. Therefore, after the checkout\n>> you still have a test_new directory.\n>>\n> \n> As far as I can tell all the files are tracked after I do a commit.\n> \n\n\"git ls-tree -r --name-only HEAD\" will show you all the tracked files.\nYou'll almost certainly want to pipe it through less or some such.\n\nTry \"git ls-tree -r --name-only | grep gitignore\" to see all the\n.gitignore files.\n\n> I can understand why it put the original test directory back when I\n> changed to the master branch but I don't understand why it's missing a\n> subdirectory.\n\nBecause that subdirectory was never tracked by git. If it had been, it\nwould have been there when you switched branches.\n\n>  I don't think the test_new directory should be in the\n> master branch at all but I guess I can kind of sort of see why git\n> might not remove it. What I can't understand at all is why it's\n> missing subdirectories.\n> \n> I hate to say this but I tried the exact same thing with mercurial in\n> the last half hour and it did exactly what I thought it should do. The\n> master had the test directory but not the test_new and the branch had\n> the test_new directory but not the test. No subdirectories were\n> missing out of either one.\n\nNaturally, since mercurial (rightly) ignores .gitignore files and the\n.git/ directory. With mercurial though, you're not only tracking the\nhistory of the files, but also the history of the object databases of\nall the git repositories you've cloned and that live in subdirectories\nof your master-project. Whether or not that's an actual problem for you\nis something you'll have to decide for yourself. If you want to keep\nthat exceptionally odd configuration, please remember to never run\n\"git repack -a\" in the subdirectories originating from github clones,\nor mercurial will think files have gone missing.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n\nRegister now for Nordic Meet on Nagios, June 3-4 in Stockholm\n http://nordicmeetonnagios.op5.org/\n\nConsidering the successes of the wars on alcohol, poverty, drugs and\nterror, I think we should give some serious thought to declaring war\non peace.\n"},{"id":"114466","messageId":"20090522133652.GA8689@andros.its.yale.edu","threadId":"19437","inReplyTo":"855e4dcf0905212046o3e1d6ec6l487829a0a411dcaf@mail.gmail.com","subject":"Re: can anybody explain the following to a git noob?","fromName":"Dan Loewenherz","fromEmail":"dloewenherz@gmail.com","sentAt":"2009-05-22T13:36:52Z","receivedAt":"2009-05-22T13:36:52Z","isPatch":false,"sender":{"key":"dloewenherz@gmail.com","avatar":"https://gravatar.com/avatar/69134b10dc6663fd8a4ac95edc0e556662c43c3acb226cec9f697cb8848198b2?d=mp&s=160"},"body":"It would be nice if instead of a transcript, you provided us with a script\nthat duplicated your problem instead of having everyone on the git-list play\n20 questions.\n\nIn any case, I'm going to try and explain what's going on.\n\nOn 22/05/09 15:46 +1200, Tim Uckun wrote:\n>git mv vendor vendor_new\n>fatal: source directory is empty, source=vendor/plugins/acts_as_audited,\n>destination=vendor_new/plugins/acts_as_audited\n\nTry reading `man git-mv`. \"...it renames <source>, which must exist...\".\n\n>ls vendor/plugins/acts_as_audited/\n>CHANGELOG  generators  init.rb  lib  LICENSE  Rakefile  README  spec  tasks\n>test.txt\n\nWhat was this `ls` for? Also, next time try doing `ls -a` so people know\nwhat hidden files exist.\n\n>ls test\n>fixtures  functional  integration  mocks  test_helper.rb  unit  watir\n\nAgain, `ls -a`.\n\n>git mv test test_new\n>git commit -m 'renamed the test directory'\n\nWhere is `git add .`?? Additionally, you must specific the `-a` flag on `git\ncommit` to apply the commit to files you removed.\n\n>********Checkout master. WTF?: Both the test and the test_new directories\n>exist. Why does the test_new exist in this branch?\n>git checkout master\n>ls\n>app  Capfile  config  db  doc  lib  MyProject.kpf  public  Rakefile  README\n>script  test  test_new  tmp  vendor\n\nThis is because you didn't commit the deletion of test. I can't speak to\nanything else. It's like telling you to change your tires when the engine\nhas disintegrated.\n\nBest,\nDan\n"},{"id":"114480","messageId":"alpine.LNX.2.00.0905221244370.2147@iabervon.org","threadId":"19437","inReplyTo":"855e4dcf0905220436h1b6fa632q7804c98bf09b324c@mail.gmail.com","subject":"Re: can anybody explain the following to a git noob?","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2009-05-22T17:33:56Z","receivedAt":"2009-05-22T17:33:56Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Fri, 22 May 2009, Tim Uckun wrote:\n\n> >\n> > Did test_new contain ignored files?\n> \n> No.  I put the entire transcript in the first email. I did not tell\n> git to ignore anything and there were no .git directories in the test\n> folder.\n\nObviously, there's more before the transcript started; otherwise, there \nwould be nothing to import in the initial commit, and there certainly \nwouldn't be .git directories that came from nowhere. I don't think any \nversion control system I know of likes having your initial import be of a \ndirectory with other working directories for the same system as \nsubdirectories. (That is, Mercurial will be fine having git working \ndirectories in the import, but git won't, and Mercurial wouldn't be happy \nabout having Mercurial working directories as subdirectories).\n\n> \n> > In this case, when you checkout the\n> > branch that does not have test_new, only the tracked files are removed;\n> > the ignored (i.e untracked) files remain. Therefore, after the checkout\n> > you still have a test_new directory.\n> >\n> \n> As far as I can tell all the files are tracked after I do a commit.\n> \n> I can understand why it put the original test directory back when I\n> changed to the master branch but I don't understand why it's missing a\n> subdirectory.  I don't think the test_new directory should be in the\n> master branch at all but I guess I can kind of sort of see why git\n> might not remove it. What I can't understand at all is why it's\n> missing subdirectories.\n\nThis tends to happen if, while on a different branch, you editted some \nfiles and left editor backups or compiled (maybe just-in-time) files in \nthat directory. Then there are files in the directory that don't belong to \nany branch, since they're not source files.\n\nIt's also highly likely that what's missing is stuff you thought you \nimported initially, but did not actually import due to the confusion with \nit already being a git working directory.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"114494","messageId":"855e4dcf0905230103q33508f0eh3aa2838ee71e0a81@mail.gmail.com","threadId":"19437","inReplyTo":"alpine.LNX.2.00.0905221259330.27232@reaper.quantumfyre.co.uk","subject":"Re: can anybody explain the following to a git noob?","fromName":"Tim Uckun","fromEmail":"timuckun@gmail.com","sentAt":"2009-05-23T08:03:56Z","receivedAt":"2009-05-23T08:03:56Z","isPatch":false,"sender":{"key":"timuckun@gmail.com","avatar":"https://gravatar.com/avatar/86579dfb796bcf3aa7743316c31dc724afc0f0fcd65890b69aee52ee4d9e2dc3?d=mp&s=160"},"body":"> What's in the subdirectory?  Is it empty?  If so, that would explain what\n> you are seeing.  Git doesn't track directories - so an empty directory is\n> always treated as an untracked file.\n\nThe directories are not empty. They contain various tests (unit tests,\nintegration tests etc).\n\n>\n> I don't know if mercurial tracks directories, if it does, then this would\n> explain why it behaves diffently to git.\n>\n\nThat might be the reason.\n\nI am just baffled. I have run that script many times and it always\nturns out the same. For example on one run I removed all the .git\ndirectories in all the subdirectories to see if I would get different\nresults but it didn't help (git mv worked but the messed up\ndirectories remained).\n\nI also tried renaming other directories and similar things happen.\n"},{"id":"114496","messageId":"855e4dcf0905230121h28ef22f8n4758953e612325cf@mail.gmail.com","threadId":"19437","inReplyTo":"alpine.LNX.2.00.0905221244370.2147@iabervon.org","subject":"Re: can anybody explain the following to a git noob?","fromName":"Tim Uckun","fromEmail":"timuckun@gmail.com","sentAt":"2009-05-23T08:21:09Z","receivedAt":"2009-05-23T08:21:09Z","isPatch":false,"sender":{"key":"timuckun@gmail.com","avatar":"https://gravatar.com/avatar/86579dfb796bcf3aa7743316c31dc724afc0f0fcd65890b69aee52ee4d9e2dc3?d=mp&s=160"},"body":">\n> Obviously, there's more before the transcript started; otherwise, there\n> would be nothing to import in the initial commit, and there certainly\n> wouldn't be .git directories that came from nowhere.\n\nSorry. The command before git init is svn export  blah/blah/blah/\n\nI am taking a rails project and putting it under git.  The .git files\nare there in the pluging because the plugins are hosted on github and\nthey ware installed via git clone.\n\nI know people keep mentioning those directories so I want to repeat\nmyself.  I renamed the test directory which had no .git folders\nanywhere in them.  It contains the tests for the rails project and\nnothing else.\n\n\n\n> I don't think any\n> version control system I know of likes having your initial import be of a\n> directory with other working directories for the same system as\n> subdirectories. (That is, Mercurial will be fine having git working\n> directories in the import, but git won't, and Mercurial wouldn't be happy\n> about having Mercurial working directories as subdirectories).\n>\n\nI now realize that.  I did however did the same thing again but first\ndeleted all the .git directories before doing a git init.  The end\nresult didn't change.\n\n\n>> > In this case, when you checkout the\n>> > branch that does not have test_new, only the tracked files are removed;\n>> > the ignored (i.e untracked) files remain. Therefore, after the checkout\n>> > you still have a test_new directory.\n\nI now understand that this is the way git works. I wasn't expecting\nthis though. I was exptecting the master branch to look like it was\nbefore I switched to another branch and mucked around.\n\nAs I said in a previous email mercurial worked as I was expecting.\nSubversion also works the way I expected. Coming from subversion I\nnever expected git to carry the new directory name into the original\nbranch.\n\nThe way I have always thought about branches was that they are\nisolated from other branches and it surprised me greatly when git\n\"leaked\" the new directory from the \"my_branch\" branch into master.\n\nI still kind of think I did something wrong.  This behavior seems\nextremely odd to me.\n\n> This tends to happen if, while on a different branch, you editted some\n> files and left editor backups or compiled (maybe just-in-time) files in\n> that directory. Then there are files in the directory that don't belong to\n> any branch, since they're not source files.\n\nI didn't edit any files. I didn't compile anything. There should have\nbeen on artifacts of any sort.  I did a commit before switching\nbranches.\n\n\n> It's also highly likely that what's missing is stuff you thought you\n> imported initially, but did not actually import due to the confusion with\n> it already being a git working directory.\n>\n\nAs I said the test directories did not have any .git directories in\nthem. If they had  git mv would not have worked.\n"},{"id":"114658","messageId":"20090525111059.GE1070@macbook.lan","threadId":"19437","inReplyTo":"855e4dcf0905230121h28ef22f8n4758953e612325cf@mail.gmail.com","subject":"Re: can anybody explain the following to a git noob?","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2009-05-25T11:10:59Z","receivedAt":"2009-05-25T11:10:59Z","isPatch":false,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"On Sat, May 23, 2009 at 08:21:09PM +1200, Tim Uckun wrote:\n> > I don't think any\n> > version control system I know of likes having your initial import be of a\n> > directory with other working directories for the same system as\n> > subdirectories. (That is, Mercurial will be fine having git working\n> > directories in the import, but git won't, and Mercurial wouldn't be happy\n> > about having Mercurial working directories as subdirectories).\n> >\n> \n> I now realize that.  I did however did the same thing again but first\n> deleted all the .git directories before doing a git init.  The end\n> result didn't change.\n\nNote that a second git init does not delete the previous database. So if\nyou want to start from scratch you need to delete the main .git folder.\n\nAs already mentioned a script recreating your setup from public sources\nwould really be a big help to find out were git does not do what you are\nexpecting.\n\ncheers Heiko\n"},{"id":"114669","messageId":"855e4dcf0905250552r27e73a15tc06dbd9fa1cbb507@mail.gmail.com","threadId":"19437","inReplyTo":"20090525111059.GE1070@macbook.lan","subject":"Re: can anybody explain the following to a git noob?","fromName":"Tim Uckun","fromEmail":"timuckun@gmail.com","sentAt":"2009-05-25T12:52:29Z","receivedAt":"2009-05-25T12:52:29Z","isPatch":false,"sender":{"key":"timuckun@gmail.com","avatar":"https://gravatar.com/avatar/86579dfb796bcf3aa7743316c31dc724afc0f0fcd65890b69aee52ee4d9e2dc3?d=mp&s=160"},"body":">\n> Note that a second git init does not delete the previous database. So if\n> you want to start from scratch you need to delete the main .git folder.\n\nYes of course.\n\n\n> As already mentioned a script recreating your setup from public sources\n> would really be a big help to find out were git does not do what you are\n> expecting.\n>\n\nOK. I'll give that a shot.\n\nI would still like to know what went wrong with my own sources though.\n After all I am going to be using it with my own sources.\n"}]}