git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug in alternates
@ 2010-08-12  0:26 Michael Geddes
  2010-08-12  0:50 ` Chris Packham
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Geddes @ 2010-08-12  0:26 UTC (permalink / raw)
  To: git

Hi - I had a bit of a hiccup with git yesterday - there's a bit of a story to 
it, which at the least might be amusing. There's script to reproduce at the 
bottom if you don't care for the story.

I had done a 
 git clone --reference Foo  git@host:Foo Foo.New
then after getting it right, I  did
 mv Foo Foo.old
 mv Foo.New Foo

Then I  had all these missing references, and I thought .. oh yeah, that's 
cause it can't find the references.. well I don't really know how to change 
that (I do now), but I want all the objects in that directory anyway for when 
I delete the Foo.old directory..
so I did a 

cd Foo
git fetch

.. so all was good for a while.. It was all there and hunky-dory.

Then.. the fated git gui  'garbage collect' dialogue appeared, and I thought, 
"why not", so I did.

At that point, git decided to pack all the references (yay) .. and then it 
said.. hmm.. are those available in my alternates .. let's see  
..Foo/.git/objects  .. yeah - all those objects are there.. so I can just 
remove that pack.

Woops. 

If you're not following the story, the Foo repo had itself as an alternate.

Include me in replies please- I'm not on the list.

//.ichael Geddes

Here's the script:
------------8<-----------testalt--------------
#!/bin/sh
mkdir testaltrep
cd testaltrep
git init 
for i in 1 2 3 4 5 6 7 8 9 ; do
  touch $i.txt
  git add $i.txt 
done
git commit -m "Commit" 
echo "$PWD/.git/objects" > .git/objects/info/alternates
# Seems like it has to be done like this to get it to repack.
git repack -adl && git repack -ad  && git repack -adl
if git checkout master   ; then
  echo OK
  ret=0
else
  echo BAD Unable to checkout reference
  ret=1
fi

cd ..
rm -rf testaltrep

exit ${ret}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug in alternates
  2010-08-12  0:26 Bug in alternates Michael Geddes
@ 2010-08-12  0:50 ` Chris Packham
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Packham @ 2010-08-12  0:50 UTC (permalink / raw)
  To: Michael Geddes; +Cc: git

On 11/08/10 17:26, Michael Geddes wrote:
> If you're not following the story, the Foo repo had itself as an alternate.
>

I had done a little messing with putting a UI around alternates a while
back (if I ever find those elusive round tuits I'll pick it up again).
There are also more complicated cases where you could end-up recursively
including yourself, I managed to do that at least once in my messing
around.

It shouldn't be too hard to add some safety checks to git gc or git
repack but they should take the possibility of recursive alternates into
account.

> Include me in replies please- I'm not on the list.
>

That's the norm around here.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-12  0:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-12  0:26 Bug in alternates Michael Geddes
2010-08-12  0:50 ` Chris Packham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).