Stefan Beller <sbeller@xxxxxxxxxx> writes: > I thought this is an optimization for C code where you have a diff like: > > int existingStuff1(..) { > ... > } > + > + int foo(..) { > +... > +} > > int existingStuff2(...) { > ... > > Note that the closing '}' could be taken from the method existingStuff1 instead > of correctly closing foo. That is a less optimal output. Another possible output would be like so: int existingStuff1(..) { ... } + int foo(..) { +... +} + int existingStuff2(...) { All three are valid output, and ... > So the correct heuristic really depends on what kind of text we > are diffing. ... this realization is correct. I have a feeling that any heuristic would be correct half of the time, including the ehuristic implemented in the current code. The readers of patches have inherent bias. They do not notice when the hunk is formed to match their expectation, but they will notice and remember when they see something less optimal. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html