-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleaner diffs for inserted array items #38
Comments
Repro with git producing clean results:
|
I looked into this a bit, out of curiosity. This issue is specific to arrays of strings; it only occurs when string items of two arrays get diffed against eachother. What's going on is that the first pair of strings ( The issue is caused by the fact that string descriptors provide Simply removing that short-circuiting step solves this issue, but also prevents string items from ever being deeply diffed against eachother. E.g., the original example correctly produces
but diffing two arrays of similar strings against eachother produces e.g.
instead of the current result,
(which is incidentally itself a little bugged, the opening backtick is on the wrong line). I'm not sure there's a perfect solution here, |
Isolated test case as requested in avajs/ava#1521
If you append an item to an array and diff:
You get neat output:
[ 'foo', 'bar', 'fizz', 'buzz', + 'hi', ]
However if you insert anywhere else and diff:
The output is quite hard to follow after the inserted item:
The text was updated successfully, but these errors were encountered: