jsdiff
jsdiff copied to clipboard
Eliminate `linedelimiters` from structured diff hunks
It's confusing and shouldn't be necessary.
Steps to this:
- Figure out precisely what the scenario was in https://github.com/kpdecker/jsdiff/issues/141 that was tripping up @soulbeing. (Did the diff file use
\r\nendings, or just the file being patched? Was this a case of a diff generated from a file with\nendings being applied to a file with\r\nendings? How do Unixdiff/patchtools handle this case?) - Somehow make
applyPatchmagically handle that scenario, without needing thelinedelimitersproperty on the patch
I confess I'm a bit confused about why that property would ever be necessary, since if you're working purely with files with \r\n endings, creating and applying diffs using tools that assume lines end with \n should work fine - the tools will just treat the \r at the end of every line as an ordinary character, but that doesn't prevent them from working any more than if the files you were diffing had a letter x or something at the end of every line.
So I think the scenario that motivated that patch must in some way have involved working with a mixture of \n endings and \r\n endings? Like, it lets us apply a patch generated on a file with \r\n endings to one with \n endings, maybe?
I should confirm that that is so, and if it is, add tests for it!
(https://github.com/kpdecker/jsdiff/pull/435 is a start towards this and fixes an outright bug, but I think we can probably go further.)