Re: [BUG] git-am silently applying patches incorrectly
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Mar 4, 2011, 19:18 UTC
- Message-ID
- <AANLkTim=jpJmBZmtAVX2V8Ui44AwpTbevJtSR2Xk=wLX@mail.gmail.com>
- In-Reply-To
- <7v39n27llq.fsf@alter.siamese.dyndns.org>
On Fri, Mar 4, 2011 at 11:05 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
> > 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