-
Notifications
You must be signed in to change notification settings - Fork 510
createTwoFilesPatch and newlines - is this working as expected? #598
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
Comments
Hmmm... this looks wrong to me. In the first case (new version has a trailing newline, old version doesn't), GNU --- old.txt 2025-04-28 10:39:39.716869201 +0100
+++ new.txt 2025-04-28 10:42:06.787201215 +0100
@@ -1,3 +1,4 @@
One line
+One.Five line
Two line
-Other lines
\ No newline at end of file
+Other lines I would think we ought to be outputting the same patch and the output you exhibit is surely a bug, quite possibly introduced by me since I took over maintaining jsdiff. Yuck. Will investigate. |
Oh - but I can't reproduce. This is what I see using the version of jsdiff on master, which agrees with GNU
What version were you using that produced the output you quote in the issue? |
Aha! I can reproduce the output quoted in the issue if I use
But not with
|
Seems like I am the hero of this story and not the villain as I first assumed! I believe the issue you're hitting is the one I describe fixing in this entry from the release notes for 6.0.0:
6.0.0 introduced a new (unrelated) bug and shouldn't be used, but upgrading to 7.0.0 (which is just 6.0.0 without the new bug) should fix everything for you. |
oooh! nice! I will give it a try as soon as I can! but sounds like it should be fine - so ill just ping here again if there is a problem still! Else, thank you very much :) |
Not sure if bug or using the api wrong, but trying to get the diff from these two:
Old text
New text with new line
Where new text has a new line at the end of the file, I get this patch diff:
The
\ No newline at the end of file
. Is that in the right place? How do I tell that a new line was added. If I do it the other way around - i.e. new line is in old text, and I remove it in new text then I getWas
\ No newline at end of file
added or removed?The text was updated successfully, but these errors were encountered: