Skip to content
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

load_large_diff generates incorrect patch if old file does not end in a newline #1438

Open
MarkRx opened this issue Jan 3, 2025 · 1 comment

Comments

@MarkRx
Copy link
Contributor

MarkRx commented Jan 3, 2025

If part of a diff doesn't end in a newline (such as a file not ending in a newline) then the generated patch in load_large_diff might mash two lines together into one line.

Example:

patch = load_large_diff("test.py",
"""\
old content 1
some new content
another line
""",
"""
old content 1
old content 2""")

print(patch)

output (observe the line -old content 2+some new content):

--- 
+++ 
@@ -1,3 +1,3 @@
-
 old content 1
-old content 2+some new content
+another line
@MarkRx MarkRx changed the title load_large_diff generates incorrect diff if old file does not end in a newline load_large_diff generates incorrect patch if old file does not end in a newline Jan 3, 2025
@mrT23
Copy link
Collaborator

mrT23 commented Jan 4, 2025

see #1439

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants