GoBoundless / dyph

A library of useful diffing algorithms for Ruby
https://www.boundless.com/
MIT License
8 stars 2 forks source link

combination of two prs #33

Closed kevinmook closed 9 years ago

kevinmook commented 9 years ago

Accidentally did this on Andrew's branch.

His change was to not join results when there is a conflict.

My change is to fix a few edge cases when diffing two objects that have both moves and inserts. It was effectively shuffling the diffed output. One example of what it was outputting:

left  = "ants bears cat dog".split
base  = "ants bears cat dog".split
right = "ants elephant cat bears dog".split

expected: ["ants", "elephant", "cat", "bears", "dog"]
got: ["ants", "elephant", "bears", "cat", "dog"]

We also changed the default differ from the Heckel differ to the Resig differ for all cases, which is faster and more easily understood. Interestingly, both differs barfed on these kind of move + insert diffs, though in different ways. We only fixed the Resig differ so it may make sense to remove the Heckel differ at some point.

kevinmook commented 9 years ago

Update: we removed the Heckel differ completely as it was broken