{"thread":{"id":"24713","subject":"Bug in alternates","startedAt":"2010-08-12T00:26:52Z","lastAt":"2010-08-12T00:50:11Z","messageCount":2,"participants":["Michael Geddes","Chris Packham"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"147848","messageId":"201008120826.53902.michael@frog.wheelycreek.net","threadId":"24713","inReplyTo":null,"subject":"Bug in alternates","fromName":"Michael Geddes","fromEmail":"michael@frog.wheelycreek.net","sentAt":"2010-08-12T00:26:52Z","receivedAt":"2010-08-12T00:26:52Z","isPatch":false,"sender":{"key":"michael@frog.wheelycreek.net","avatar":null},"body":"Hi - I had a bit of a hiccup with git yesterday - there's a bit of a story to \nit, which at the least might be amusing. There's script to reproduce at the \nbottom if you don't care for the story.\n\nI had done a \n git clone --reference Foo  git@host:Foo Foo.New\nthen after getting it right, I  did\n mv Foo Foo.old\n mv Foo.New Foo\n\nThen I  had all these missing references, and I thought .. oh yeah, that's \ncause it can't find the references.. well I don't really know how to change \nthat (I do now), but I want all the objects in that directory anyway for when \nI delete the Foo.old directory..\nso I did a \n\ncd Foo\ngit fetch\n\n.. so all was good for a while.. It was all there and hunky-dory.\n\nThen.. the fated git gui  'garbage collect' dialogue appeared, and I thought, \n\"why not\", so I did.\n\nAt that point, git decided to pack all the references (yay) .. and then it \nsaid.. hmm.. are those available in my alternates .. let's see  \n..Foo/.git/objects  .. yeah - all those objects are there.. so I can just \nremove that pack.\n\nWoops. \n\nIf you're not following the story, the Foo repo had itself as an alternate.\n\nInclude me in replies please- I'm not on the list.\n\n//.ichael Geddes\n\nHere's the script:\n------------8<-----------testalt--------------\n#!/bin/sh\nmkdir testaltrep\ncd testaltrep\ngit init \nfor i in 1 2 3 4 5 6 7 8 9 ; do\n  touch $i.txt\n  git add $i.txt \ndone\ngit commit -m \"Commit\" \necho \"$PWD/.git/objects\" > .git/objects/info/alternates\n# Seems like it has to be done like this to get it to repack.\ngit repack -adl && git repack -ad  && git repack -adl\nif git checkout master   ; then\n  echo OK\n  ret=0\nelse\n  echo BAD Unable to checkout reference\n  ret=1\nfi\n\ncd ..\nrm -rf testaltrep\n\nexit ${ret}\n"},{"id":"147850","messageId":"4C634543.5020301@gmail.com","threadId":"24713","inReplyTo":"201008120826.53902.michael@frog.wheelycreek.net","subject":"Re: Bug in alternates","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2010-08-12T00:50:11Z","receivedAt":"2010-08-12T00:50:11Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"On 11/08/10 17:26, Michael Geddes wrote:\n> If you're not following the story, the Foo repo had itself as an alternate.\n>\n\nI had done a little messing with putting a UI around alternates a while\nback (if I ever find those elusive round tuits I'll pick it up again).\nThere are also more complicated cases where you could end-up recursively\nincluding yourself, I managed to do that at least once in my messing\naround.\n\nIt shouldn't be too hard to add some safety checks to git gc or git\nrepack but they should take the possibility of recursive alternates into\naccount.\n\n> Include me in replies please- I'm not on the list.\n>\n\nThat's the norm around here.\n"}]}