From: Nicolas Pitre Date: Tue, 20 Mar 2007 15:23:01 GMT Subject: Re: My git repo is broken, how to fix it ? Message-ID: In-Reply-To: <7vd5349x97.fsf@assigned-by-dhcp.cox.net> On Tue, 20 Mar 2007, Junio C Hamano wrote: > Linus Torvalds 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