From: Linus Torvalds Date: Fri, 04 Mar 2011 19:18:01 GMT Subject: Re: [BUG] git-am silently applying patches incorrectly Message-ID: In-Reply-To: <7v39n27llq.fsf@alter.siamese.dyndns.org> On Fri, Mar 4, 2011 at 11:05 AM, Junio C Hamano wrote: > > And here is a quick and dirty fix to do something like that.  It assumes > that the hunks for a single file being patched are already sorted in the > ascending order (which should be the case), and may regress cases where we > used to find a match even when the version you are patching has moved > functions around in the file by failing to notice a match.  And it does > get the same result as your GNU patch test. Ack. Looks correct. In fact, shouldn't we make that "last_match" be the _end_ of the last place we applied the patch at, rather than the beginning? IOW, maybe something like "img->last_match = applied_pos + postimage.nr;" or whatever. I dunno. Linus