Re: How to fetch missing pack
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Apr 24, 2008, 06:08 UTC
- Message-ID
- <20080424060857.GX29771@spearce.org>
- In-Reply-To
- <200804240801.13674.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> wrote:
Show 12 quoted lines
> Le mercredi 23 avril 2008, Jörg Sommer a écrit : > > Peter Baumann <waste.manager@gmx.de> wrote: > > > > > > Try using git fsck --full to check you repo. If you are missing some > > > objects, you could just grab them from another valid repo which still > > > has them. > > > > How can I exctract single objects from a pack? > > Please have a look at this: > > http://git.or.cz/gitwiki/GitFaq#head-ac11406480d09e2df98588e800e41b7256602074
If you know the name of the objects you are missing, you can make a temporary pack to transfer the list of objects:
# at good repo # git pack-objects --stdout <object.list >save.pack
# at bad repo # git index-pack --stdin <save.pack
Make object.list just one SHA-1 per line. The resulting pack is not likely to be highly compressed, as it will probably contain a non-delta version of each object, but its faster to create than calling git-cat-file for each object, and may give you a smaller pack than just copying everything as the FAQ entry recommends.
Note that you may need to do this several times; e.g. if you are missing a tree you won't know what blobs you are missing until you load the tree and run fsck --full again to parse the tree and discover the missing blobs. This iterative copying approach is what the FAQ avoids when it suggests you copy everything.
-- Shawn.