Re: My git repo is broken, how to fix it ?
- From
Nicolas Pitre <nico@cam.org>
- Date
- Mar 20, 2007, 15:23 UTC
- Message-ID
- <alpine.LFD.0.83.0703201113180.18328@xanadu.home>
- In-Reply-To
- <7vd5349x97.fsf@assigned-by-dhcp.cox.net>
On Tue, 20 Mar 2007, Junio C Hamano wrote:
Show 12 quoted lines
> Linus Torvalds <torvalds@linux-foundation.org> writes: > > > But to really look at this we should probably add a "really_careful" flag > > that actually re-verifies the SHA1 on read so that we'd catch these kinds > > of corruptions early. > > ... > > I'm hoping somebody has any ideas. We really *could* check the SHA1 on > > each read (and slow down git a lot) and that would catch corruption much > > faster and hopefully pinpoint it more quickly where exactly it happens. > > At least, we could do something like this to catch the breakage > when we (re)pack, to prevent damage from propagating.
I think it would be better to retest the SHA1 when we're about to _write_ the object out to the pack, replacing check_pack_inflate() and revalidate_loose_object() with the full SHA1 check, and testing objects which data isn't reused from a pack too. And make it conditional on !pack_to_stdout like we already do of course.
Nicolas