From: Shawn O. Pearce Date: Fri, 08 Aug 2008 16:23:47 GMT Subject: Re: How to replace a single corrupt, packed object? Message-ID: <20080808162347.GD9152@spearce.org> In-Reply-To: Johannes Schindelin wrote: > On Fri, 8 Aug 2008, Johannes Schindelin wrote: > > On Fri, 8 Aug 2008, Shawn O. Pearce wrote: > > > > > Johannes Schindelin wrote: > > > > my auto gc kicked in, and shows this: > > > > > > > > fatal: corrupt packed object for 2c1e128aa51e3a64bd61556c0cd488628b423ccf > > > > error: failed to run repack Here's another idea. You have the good object loose. So do something like this: $ mkdir foo $ cd foo $ git init $ cp ../../the_good_loose_obj .git/objects/??/.... $ cd ../corrupt_repo $ ( cd ../foo; echo blob; echo data $(git cat-file -s the_good_loose_obj); git cat-file blob the_good_loose_obj; ) | git fast-import $ git repack -a -d The new pack file created by gfi will have a newer timestamp than the one with the corruption. This will cause it to sort higher in the pack list, and we'll take objects from the first pack we find it in. -- Shawn.