You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have observed that patch.py adds an extra newline at the end of the patched file even though the unified patch doesn't alter the line at all.
I know it is good behavior on Linux to have a newline at the end of the file. Some C/C++ coding standards make this even mandatory. But with PHP and some other web technologies, there are strong reasons to NOT have a newline at the end of the file, as it may result in undesired additional newline output to the client, possibly breaking everything.
Small example for illustration, including [LF] as newline ('\n') and [EOF] as the end of the file.
I have observed that patch.py adds an extra newline at the end of the patched file even though the unified patch doesn't alter the line at all.
I know it is good behavior on Linux to have a newline at the end of the file. Some C/C++ coding standards make this even mandatory. But with PHP and some other web technologies, there are strong reasons to NOT have a newline at the end of the file, as it may result in undesired additional newline output to the client, possibly breaking everything.
Small example for illustration, including [LF] as newline ('\n') and [EOF] as the end of the file.
original file (old/test.php):
with patch file (without [LF] and [EOF], generated via
diff -Naur old/test.php new/test.php > test.php.patch
):becomes:
but should be (new/test.php):
The text was updated successfully, but these errors were encountered: