-
Notifications
You must be signed in to change notification settings - Fork 4
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
Suitability inquiry: patch generation? #120
Comments
I tried to concatenate the output of multiple diffs with appropriate headers prepended, but I am facing a difficult issue. The patch format generation seems to require special handling if and only if the following conditions simultaneously hold:
This condition is non-trivial to detect, mainly because of the subcondition 1. Some support from the library would be welcome. |
I wonder since the text Unified output is the same as |
@rulatir It would be nice to have some example content to look at. |
Not exactly. You would have to add support for "No newline at end of file" situations, which I did in my lib. If there is "No newline at end of file" in --- old.txt 2022-12-04 00:29:52.529176300 +0800
+++ new.txt 2022-12-04 00:29:53.897753600 +0800
@@ -1 +1 @@
-1st
\ No newline at end of file
+1st If there is "No newline at end of file" in --- old.txt 2022-12-04 00:28:20.045745500 +0800
+++ new.txt 2022-12-04 00:28:19.206919100 +0800
@@ -1 +1 @@
-1st
+1st
\ No newline at end of file If both are "No newline at end of file", then --- old.txt 2022-12-04 00:29:52.529176300 +0800
+++ new.txt 2022-12-04 00:30:52.437851700 +0800
@@ -1 +1 @@
-1st
\ No newline at end of file
+1st added
\ No newline at end of file |
I added the function for that into https://github.com/JBlond/php-diff/tree/php-diff-120 |
@JBlond |
@DigiLive I did, and I hope that it is clear now. If not, ask rulatir for more details. |
The issue is, this lib doesn't provide the correct If #120 (comment) is not clear enough, then I think you have to diff them with Here's a sample.zip, just run Since I am not really interested in this thread and I think the elaboration is pretty clear. I am leaving. |
I'm currently looking into this issue. It seems like GNU diffutils:
@JBlond can you confirm my conclusions? |
I'm a bit puzzled by the definition. https://github.com/Distrotech/diffutils/blob/9e70e1ce7aaeff0f9c428d1abc9821589ea054f1/doc/diffutils.texi#L1718-1748 |
@DigiLive After reading a gazillion of implementations I can confirm that you are right with your conclusions.. |
Given file1, file2, file3... on disk and $modifiedContents1, $modifiedContents2, $modifiedContents3... strings (existing ONLY in memory and without ANY file representation), how difficult would it be to use this library to render a standard patch file that would apply the respective modifications to file1, file2, file3... when fed to the standard
patch
utility?The text was updated successfully, but these errors were encountered: