{"thread":{"id":"37332","subject":"Error \"fatal: not a git repository\" after auto packing","startedAt":"2014-08-11T22:56:16Z","lastAt":"2014-08-12T16:16:19Z","messageCount":4,"participants":["Luke Campagnola","Duy Nguyen","Dennis Kaarsemaker"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"247599","messageId":"CACZXET_qPzBtqJLXBbou+iZ_Muj=VqCBe5qMADN72VScsuHRVQ@mail.gmail.com","threadId":"37332","inReplyTo":null,"subject":"Error \"fatal: not a git repository\" after auto packing","fromName":"Luke Campagnola","fromEmail":"luke.campagnola@gmail.com","sentAt":"2014-08-11T22:56:16Z","receivedAt":"2014-08-11T22:56:16Z","isPatch":false,"sender":{"key":"luke.campagnola@gmail.com","avatar":null},"body":"Greetings,\n\nI have been working happily with git for a couple of years, and ran\ninto a mysterious issue today: after running a git-pull during which I\nsaw the message \"Auto packing the repository for optimum performance\".\nI now receive the error \"Fatal: not a git repository\" when running any\ngit commands, and a little investigation revealed that my .git/refs\ndirectory has gone missing, presumably because the refs were all\ncombined into .git/packed-refs. To restore access to the repository,\nall I needed was to `mkdir .git/refs`. Is this a known bug? It seems\nlike either git should tolerate the absence of a .git/refs directory,\nor the auto packer should not remove it.\n\nI am using git 1.9.1 on kubuntu 14.04. The surrounding console output follows:\n\nraven:/home/luke/vispy (transform-cache)$ git commit -a\n[transform-cache 15a0fe3] Optimizations for grid_large\n 6 files changed, 91 insertions(+), 52 deletions(-)\n\nraven:/home/luke/vispy (transform-cache)$ git push lcampagn transform-cache\nCounting objects: 114, done.\nDelta compression using up to 4 threads.\nCompressing objects: 100% (31/31), done.\nWriting objects: 100% (31/31), 4.00 KiB | 0 bytes/s, done.\nTotal 31 (delta 25), reused 0 (delta 0)\nTo git@github.com:lcampagn/vispy.git\n   24b37a6..15a0fe3  transform-cache -> transform-cache\n\nraven:/home/luke/vispy (transform-cache)$ git fetch vispy\nremote: Counting objects: 78, done.\nremote: Compressing objects: 100% (78/78), done.\nremote: Total 78 (delta 34), reused 0 (delta 0)\nUnpacking objects: 100% (78/78), done.\nFrom https://github.com/vispy/vispy\n   ec740af..fd8aa37  master     -> vispy/master\nAuto packing the repository for optimum performance. You may also\nrun \"git gc\" manually. See \"git help gc\" for more information.\nCounting objects: 5349, done.\nDelta compression using up to 4 threads.\nCompressing objects: 100% (5315/5315), done.\nWriting objects: 100% (5349/5349), done.\nTotal 5349 (delta 3977), reused 0 (delta 0)\nRemoving duplicate objects: 100% (256/256), done.\n\nraven:/home/luke/vispy (transform-cache)$ git checkout master\nSwitched to branch 'master'\nDeleted 103 .pyc files\nDeleted 11 empty directories\n\nraven:/home/luke/vispy$ git pull vispy master\nfatal: Not a git repository (or any of the parent directories): .git\n\nraven:/home/luke/vispy$ git status\nfatal: Not a git repository (or any of the parent directories): .git\n\nraven:/home/luke/vispy$ ls -al .git\ntotal 288\ndrwxr-xr-x   6 luke luke   4096 Aug 11 17:09 .\ndrwxr-xr-x   9 luke luke   4096 Aug 11 09:25 ..\n-rw-r--r--   1 luke luke    601 Aug 11 12:22 COMMIT_EDITMSG\n-rw-rw-r--   1 luke luke   1088 Aug 11 09:21 config\n-rw-r--r--   1 luke luke     73 Mar  2 08:41 description\n-rw-r--r--   1 luke luke    323 Aug 11 16:56 FETCH_HEAD\n-rw-r--r--   1 luke luke    337 Mar  3 10:18 GIT_COLA_MSG\n-rw-r--r--   1 luke luke 193478 Aug 11 11:14 gitk.cache\n-rw-rw-r--   1 luke luke     23 Aug 11 17:09 HEAD\ndrwxr-xr-x   2 luke luke   4096 Mar  8 07:30 hooks\n-rw-rw-r--   1 luke luke  31104 Aug 11 17:09 index\ndrwxr-xr-x   2 luke luke   4096 Aug 11 16:57 info\ndrwxr-xr-x   3 luke luke   4096 Aug 11 16:56 logs\ndrwxr-xr-x 105 luke luke   4096 Aug 11 16:57 objects\n-rw-rw-r--   1 luke luke     41 Aug 11 09:25 ORIG_HEAD\n-rw-rw-r--   1 luke luke   8210 Aug 11 16:56 packed-refs\n"},{"id":"247609","messageId":"CACsJy8A576_OxXNKpsar5DiJ3Z=YsG4DURxL_JceknhRxBjB+g@mail.gmail.com","threadId":"37332","inReplyTo":"CACZXET_qPzBtqJLXBbou+iZ_Muj=VqCBe5qMADN72VScsuHRVQ@mail.gmail.com","subject":"Re: Error \"fatal: not a git repository\" after auto packing","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2014-08-12T15:41:38Z","receivedAt":"2014-08-12T15:41:38Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Aug 12, 2014 at 5:56 AM, Luke Campagnola\n<luke.campagnola@gmail.com> wrote:\n> Greetings,\n>\n> I have been working happily with git for a couple of years, and ran\n> into a mysterious issue today: after running a git-pull during which I\n> saw the message \"Auto packing the repository for optimum performance\".\n> I now receive the error \"Fatal: not a git repository\" when running any\n> git commands, and a little investigation revealed that my .git/refs\n> directory has gone missing, presumably because the refs were all\n> combined into .git/packed-refs. To restore access to the repository,\n> all I needed was to `mkdir .git/refs`. Is this a known bug?\n\nNot to me.\n\n> It seems\n> like either git should tolerate the absence of a .git/refs directory,\n> or the auto packer should not remove it.\n\nI tried to clone from vispy.git, running 'git gc' manually and\n'pack-refs' (which should be in charge of removing empty dirs with\nv1.9.1. Things worked fine. Looked at\nrefs.c:try_remove_empty_parents() as well. Still could not find any\nbug there.. So no good news. I don't suppose that if you run \"git gc\"\nagain, it would remove $GIT_DIR/refs one more time?\n-- \nDuy\n"},{"id":"247610","messageId":"1407859882.17965.1.camel@spirit","threadId":"37332","inReplyTo":"CACZXET_qPzBtqJLXBbou+iZ_Muj=VqCBe5qMADN72VScsuHRVQ@mail.gmail.com","subject":"Re: Error \"fatal: not a git repository\" after auto packing","fromName":"Dennis Kaarsemaker","fromEmail":"dennis@kaarsemaker.net","sentAt":"2014-08-12T16:11:22Z","receivedAt":"2014-08-12T16:11:22Z","isPatch":false,"sender":{"key":"dennis@kaarsemaker.net","avatar":"https://avatars.githubusercontent.com/u/200649?v=4"},"body":"On ma, 2014-08-11 at 18:56 -0400, Luke Campagnola wrote:\n> \n> raven:/home/luke/vispy (transform-cache)$ git checkout master\n> Switched to branch 'master'\n> Deleted 103 .pyc files\n> Deleted 11 empty directories\n\nThis looks like you have a local post-checkout hook that deletes empty\ndirectories. Fix that hook to not do anything in .git and it should be\nfine.\n-- \nDennis Kaarsemaker\nwww.kaarsemaker.net\n"},{"id":"247611","messageId":"CACZXET-O0SZnJp_LWg_v8ZFfkUXbYtS-j96UYmMkDtbv+NZM5w@mail.gmail.com","threadId":"37332","inReplyTo":"1407859882.17965.1.camel@spirit","subject":"Re: Error \"fatal: not a git repository\" after auto packing","fromName":"Luke Campagnola","fromEmail":"luke.campagnola@gmail.com","sentAt":"2014-08-12T16:16:19Z","receivedAt":"2014-08-12T16:16:19Z","isPatch":false,"sender":{"key":"luke.campagnola@gmail.com","avatar":null},"body":"On Tue, Aug 12, 2014 at 12:11 PM, Dennis Kaarsemaker\n<dennis@kaarsemaker.net> wrote:\n> On ma, 2014-08-11 at 18:56 -0400, Luke Campagnola wrote:\n>>\n>> raven:/home/luke/vispy (transform-cache)$ git checkout master\n>> Switched to branch 'master'\n>> Deleted 103 .pyc files\n>> Deleted 11 empty directories\n>\n> This looks like you have a local post-checkout hook that deletes empty\n> directories. Fix that hook to not do anything in .git and it should be\n> fine.\n\nOf course you are correct. Sorry for the noise.\n"}]}