Andreas wrote: > ...the patch could only be applied by ignoring one line of context. > This may seem surprising, but patch assumes that hunks that have more > context at the beginning than at the end must apply at the end...
That is surprising. Thanks for the explanation. Is there a document anywhere that describes patch's algorithm in full? "Comparing and Merging Files" by MacKenzie, Eggert, and Stallman seems to have most of it, but it doesn't mention this nuance. > Always be careful with patches that apply with fuzz. When applying > patches automatically, use option -F0. Or in any case, use option -Fn, where n is less than the context in your diff. (And it doesn't make the patch succeed in my case, but at least it fails instead of applying wrongly.) I wonder if it would be worthwhile to have a companion to -Fn, perhaps -Cm, meaning "don't strip fuzz to leave less than m lines of context". I'd find that easier to think about, especially if for whatever reason I couldn't predict the contextitude of the incoming patches.