From: Brandon Casey Date: Wed, 10 Oct 2007 22:55:25 GMT Subject: Re: Spam: Re: git branch performance problem? Message-ID: <470D585D.1030808@nrlssc.navy.mil> In-Reply-To: <8c5c35580710101445h232f9a67jd0c326b3b97ae3dd@mail.gmail.com> Lars Hjemli wrote: > On 10/10/07, J. Bruce Fields wrote: >> On Wed, Oct 10, 2007 at 06:30:02PM -0300, Han-Wen Nienhuys wrote: >>> could it be that GC does not handle cyclic alternates correctly? >> Does it handle alternates at all? If you run git-gc on a repository >> which other repositories get objects from, then my impression was that >> bad things happen. >> > > AFAIK 'git gc' is safe, while 'git gc --prune' will remove loose > (unreferenced) objects. No, this is not the case, unless something has changed very recently in git-gc or git-repack. Even git-gc with no arguments is unsafe if the repository being gc'ed is listed in another's alternates. git-gc calls repack with -a and -d. which causes a new pack to be created which only contains the objects required by the local repository. The other packs are then deleted. Objects contained in those packs and required by a "sharing" repository (one using the alternates mechanism) will be deleted if the local repository no longer references them. Maybe git-gc should make use of repack's new -A option by default and only use -a (and not -A) when --prune is specified... -brandon