{"thread":{"id":"30279","subject":"IRC discussion re: submodules & missing refs/heads/master","startedAt":"2012-04-18T19:56:11Z","lastAt":"2012-04-18T21:22:12Z","messageCount":3,"participants":["Kent Fredric","Heiko Voigt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"189651","messageId":"CAATnKFDM5a9diHPg5QtS-jqEC1oYWL3a1dYnpwFLZK1UktgJAA@mail.gmail.com","threadId":"30279","inReplyTo":"CAATnKFCAAwJYTx42iX5ZQ5-HrygFwUCWnKDNj0GDydwPYs-Nvg@mail.gmail.com","subject":"IRC discussion re: submodules & missing refs/heads/master","fromName":"Kent Fredric","fromEmail":"kentfredric@gmail.com","sentAt":"2012-04-18T19:56:11Z","receivedAt":"2012-04-18T19:56:11Z","isPatch":false,"sender":{"key":"kentfredric@gmail.com","avatar":null},"body":"Relevant transcript from IRC with jrnieder\n\n---\n06:47:09 < kent\\n> I have a fun problem, somethings gone wrong with a\nsubmodule somehow, now \"git status\" and friends just go \"Fatal: Oops!\"\n06:47:39 < kent\\n> Ok, no !, but thats basically what I get :/\n06:48:29 < cbreak> kent\\n: GIT_TRACE=1 git status ?\n06:48:47 < FauxFaux> strace $(git --exec-dir)/git-status\n06:50:01 < kent\\n> cbreak: trace: built-in: git 'status'  , fatal: Oops\n06:50:26 < kent\\n> FauxFaux: doesn't work, status is a builtin, not a\ncommand.\n06:50:45 < jrnieder> kent\\n: do you mean literally \"fatal: Oops\"?\n06:50:50 < kent\\n> yes. Literally.\n06:50:54 < FauxFaux> kent\\n: ...that's what the purpose of the $() bit is.\n06:51:16 < kent\\n> FauxFaux: git --exec-dir dies anyway because it doesn't\nknow what I'm asking it to do\n06:51:17 < jrnieder> kent\\n: I don't see that error message anywhere in the\nsource code\n06:51:21 < jrnieder> what version of git are you using?\n06:51:24 < FauxFaux> kent\\n: Uh, --exec-path\n06:51:47 < FauxFaux> Also --version, yeah.\n06:51:58 < jrnieder> ah, you didn't mean literally \"fatal: Oops\"\n06:52:02 < jrnieder> you meant \"fatal: oops\"\n06:52:11 < FauxFaux> Yay paraphrasing.\n06:52:23 < kent\\n> no, it has an upper-case O for me.\n06:53:02 < jrnieder> kent\\n: ok, git version then?\n06:53:22 < kent\\n> 1.7.8.5\n06:54:04 < kent\\n> strace seems to tell me the problem is its looking for\nthe ref \"head\" on the submodule, but for some reason, the path when stat()\n'd returns not found\n06:54:06 < jrnieder> kent\\n: thanks\n06:55:04 < jrnieder> this code changed a bit in v1.7.9-rc1~10^2~7 (Pass a\n(ref_cache *) to the resolve_gitlink_*() helper functions, 2011-12-12)\n06:55:13 < kent\\n> for some reason, my 'refs/heads' directory for my\nsubmodule is empty :/\n07:03:14  * kent\\n looks around in his .git/refs dir and finds a bunch of\nempty directories not seeming to correspond to anything\n\n\n07:13:52 < kent\\n> yay. managed to fix it. blew away module/${modname}/refs\n, checked out a new branch in the module, deleted master, rechecked out\nmaster, problem solved. ( wtf )\n07:15:52  * kent\\n has no idea why\n.git/modules/${modpathtingythere}/refs/heads/master  vanished.\n07:16:02 < jrnieder> kent\\n: hmm\n07:16:16 < jrnieder> do you have a backup of the problematic state, or can\nyou make it happen again?\n07:16:29 < kent\\n> I'm going to try, should be as easy as rm\nrefs/heads/master\n07:16:37 < jrnieder> ok\n07:17:28 < kent\\n> yep, that causes the problem to return.\n07:17:34 < jrnieder> excellent\n07:17:55 < jrnieder> if you use git 1.7.9 or newer, are the symptoms the\nsame?\n07:18:13 < kent\\n> will give it a whirl, fortunately, have 2 boxen with\ndifferent gits =)\n07:19:12 < jrnieder> (another way if you don't want to upgrade your system\ncopy of git is to do: \"git clone git://repo.or.cz/git.git; cd git; make -j4\"\nand then use bin-wrappers/git from the source tree in place)\n07:20:42 < jrnieder> kent\\n: I have to head out now but anyway, this seems\ninteresting\n07:20:59 < jrnieder> whether 1.7.9 fixes it or not, if you get a chance to\nemail git@vger.kernel.org about it, that would be useful\n07:21:17 < kent\\n> kk. will do.\n07:21:21 < jrnieder> thanks much\n\nDigging tells me that either Git gc or git prune is stripping the\n\"master\" file, causing the issue:\n\ncd $ROOT/metadata/perl/\n\nmd5sum $( find ../../.git/modules/metadata/perl/ -type f ) > /tmp/pregc\ngit gc\nmd5sum $( find ../../.git/modules/metadata/perl/ -type f ) > /tmp/postgc\ngit prune\nmd5sum $( find ../../.git/modules/metadata/perl/ -type f ) > /tmp/postprune\n\ndiff3 /tmp/pregc /tmp/postgc /tmp/postprune\n====1\n1:4c\n  4800e0911d51d4829e5650c487931108\n../../.git/modules/metadata/perl/refs/heads/master\n2:3a\n3:3a\n\nSo it seems 1.7.8.5 is removing that file for some unknown reason.\n\ncd $ROOT/metadata/perl\ngit status\n\n# On branch master\nnothing to commit (working directory clean)\n\ncd $ROOT/\n\ngit status\n\nfatal: Oops\n\n\nRsyncing that to a box with 1.7.9.4  , and giving it  a little path cleanup :\n\n  sed -i 's!/var/paludis/repositories/perl-git/!/tmp/mirrorbox/!' $(\ngrep 'var/paludis/repositories' -R -l .  )\n\ncd $ROOT\n\n git status\n# On branch master\n# Changes not staged for commit:\n#   (use \"git add <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#\tmodified:   metadata/perl (new commits)\n#\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#\t.mailmap\n#\tTodo.txt\n#\tdists.txt\n#\tfilterchange.pl\n#\tfixme.pl\n#\titemise_diff.pl\n#\trebase.sh\n#\trebase2.sh\n#\trebash.sh\n#\trebash2.pl\n#\trebash2.pl.bak\n#\tscripts/gen_metadata.pl\n#\tts\n#\tupdate-index.sh\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n[master *%] kent@katipo: /tmp/mirrorbox\n\n\n( ALL GOOD )\n\ncd $ROOT/metadata/perl\n\ngit status\n\ngit status\n# On branch master\nnothing to commit (working directory clean)\n\n( ALL GOOD )\n\nFrankly, thats just .... weird.\n\n--\nKent\n\nperl -e  \"print substr( \\\"edrgmaM  SPA NOcomil.ic\\\\@tfrken\\\", \\$_ * 3, 3 )\nfor ( 9,8,0,7,1,6,5,4,3,2 );\"\n\nhttp://kent-fredric.fox.geek.nz\n"},{"id":"189669","messageId":"20120418211426.GA6920@book.hvoigt.net","threadId":"30279","inReplyTo":"CAATnKFDM5a9diHPg5QtS-jqEC1oYWL3a1dYnpwFLZK1UktgJAA@mail.gmail.com","subject":"Re: IRC discussion re: submodules & missing refs/heads/master","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2012-04-18T21:14:26Z","receivedAt":"2012-04-18T21:14:26Z","isPatch":false,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"Hi,\n\nOn Thu, Apr 19, 2012 at 07:56:11AM +1200, Kent Fredric wrote:\n> Relevant transcript from IRC with jrnieder\n> \n[...]\n\n>From the subject I deduce that you have a some problem involving\nsubmodules. Could you please clearly summarise what you found and\npossibly provide a recipe (script snippet) how to reproduce the issue?\n\nCheers Heiko\n"},{"id":"189671","messageId":"CAATnKFCoE6XXTB48Mvq-ay-j-1gyxxPBUvLM+REFWHLCsrTsVQ@mail.gmail.com","threadId":"30279","inReplyTo":"20120418211426.GA6920@book.hvoigt.net","subject":"Re: IRC discussion re: submodules & missing refs/heads/master","fromName":"Kent Fredric","fromEmail":"kentfredric@gmail.com","sentAt":"2012-04-18T21:22:12Z","receivedAt":"2012-04-18T21:22:12Z","isPatch":false,"sender":{"key":"kentfredric@gmail.com","avatar":null},"body":"On 19 April 2012 09:14, Heiko Voigt <hvoigt@hvoigt.net> wrote:\n> From the subject I deduce that you have a some problem involving\n> submodules. Could you please clearly summarise what you found and\n> possibly provide a recipe (script snippet) how to reproduce the issue?\n>\n\nThe transcript was provided for context, after the transcript are\ndetails of the problem and solution.\n\nSummarised is as follows:\n\non 1.7.8.5 ,  running \"git gc\" while inside a submodule path removes\nrefs/heads/master  for that submodule in ~/.git/modules  , and for\nsome reason, sub-modules still require those files to work properly at\n1.7.8.5 , ( which results in 'git status' bailing with 'oops' from the\nmain repo )\n\nMigrating to a newer git makes the problem vanish, as the newer git\nuses info/refs for both the main repo and the submodule, and the\npresence/absense of refs/heads/master is unimportant.\n\nSolving it is reasonably straight forward on 1.7.8.5, manually extract\nthe SHA1 from the modules info/refs file, and inject it back into the\nrelevant file refs/heads/master  , and things return to normal.\n\n\n-- \nKent\n\nperl -e  \"print substr( \\\"edrgmaM  SPA NOcomil.ic\\\\@tfrken\\\", \\$_ * 3,\n3 ) for ( 9,8,0,7,1,6,5,4,3,2 );\"\n\nhttp://kent-fredric.fox.geek.nz\n"}]}