bug-patch
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-patch] patch cannot handle >3 lines of context


From: Andreas Grünbacher
Subject: Re: [bug-patch] patch cannot handle >3 lines of context
Date: Sat, 18 Jul 2015 09:19:27 +0200

2015-07-17 19:49 GMT+02:00 Jörn Engel <address@hidden>:
> Noticed the problem trying to apply the hunk below.  It applies just
> fine with git, but fails to apply with GNU patch.  Cutting the 7-line
> context above the patch down to 3-line context fixes the issue.  Cutting
> it down to 5-line context makes it apply with fuzz 2.

The reason is that there are more lines of prefix context than suffix context,
which makes patch assume that the hunk must apply at the end of the
file. (Without this heuristic, hunks from the beginning or end of a file
misapply very easily.)

Once two lines of a hunk with five prefix context lines and three suffix
context lines are stripped (fuzz 2), the number of context lines balances
out again, and the hunk will apply anywhere in the file.

Andreas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]