From: Jeff King Date: Sun, 16 Dec 2007 21:21:04 GMT Subject: Re: trim_common_tail bug? Message-ID: <20071216212104.GA32307@coredump.intra.peff.net> In-Reply-To: <7v7ijejq6j.fsf@gitster.siamese.dyndns.org> On Sun, Dec 16, 2007 at 01:16:36PM -0800, Junio C Hamano wrote: > > I wanted to recover to the end of the line that includes the cut-off > > point, even when (ctx == 0), to be extra safer, but I do not think it > > was necessary. > > I have to wonder what happens if the last line which is incomplete has > more than block bytes that are identical at the end? We need to recover > the whole thing to show the correct diff, don't we? No, I think it's right as-is. We forget about the blocks during the recovery section of the code. IOW, we just keep reading forward until we find all of the context lines, or we run out of trimmed content. In the first case, we are fine (we restored the right number of context lines). In the latter case, we are also fine, because we end up trimming nothing (IOW, there _weren't_ enough context lines in the first place). -Peff