Re: Retrospectively add alternates to a repository?
- From
Jeff King <peff@peff.net>
- Date
- Feb 27, 2010, 08:34 UTC
- Message-ID
- <20100227083418.GC27191@coredump.intra.peff.net>
- In-Reply-To
- <be6fef0d1002261837g794e8df2yc92261d46f3235bd@mail.gmail.com>
On Sat, Feb 27, 2010 at 10:37:25AM +0800, Tay Ray Chuan wrote:
> yes, just make sure the objects/info/alternates file points to the > location of that cloned repo's object directory; for example: > > $ echo /path/to/cloned/repo/.git/objects > .git/objects/info/alternates
You will probably want to then get rid of anything in the child that is now available in the alternates repository.
I would have thought "git repack -adl" works, but I think there is something a little funny in the logic. It reports "nothing new to pack", but does not delete the loose objects. But packing first then worked:
$ git clone large-parent child $ echo $PWD/large-parent/.git/objects >child/.git/objects/info/alternates $ cd child
$ du -sh .git/objects 51M .git/objects
$ git repack -adl && du -sh .git/objects Nothing new to pack. 51M .git/objects
$ git repack -ad && du -sh .git/objects Counting objects: 3, done. Delta compression using up to 2 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), done. Total 3 (delta 0), reused 0 (delta 0) 51M .git/objects
$ git repack -adl && du -sh .git/objects Nothing new to pack. 20K .git/objects
-Peff