Infinite loop in diff_cleanup_merge()
While I am still actively debugging this, it would be nice to get a second set of eyes on this:
Take file a
a
bcde
Then file b
A
bcdefghijklmnopqrs
The process works as expected:
> "a\x0abcde\x0a"
-"a", +"A", ="\x0abcde", +"fghijklmno", ="\x0a"
< "A\x0abcdefghijklmnopqrs\x0a"
But if you add one more character to the second line of file b (note the trailing t)
A
bcdefghijklmnopqrst
The third iteration of diff_cleanup_merge() will never hit i != -1
As I've stated, I'm actively debugging this, but just thought you might want to know.
I think I ran into the same problem. I have a specific pattern (more complex that yours) that locks the diff algorithm up, but removing the diff_cleanup_merge() call avoids the deadlock. @elizey, did you have any progress with this? At least it looks like the bug is in diff_cleanup_merge() which is pretty much self contained and doesn't require knowledge about the diff algorithm itself.
Fixed :-) See PR above.