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
In our example files, a and b contains a empty trailing line (a: 34, b: 33).
This library (and many other software) doesn't care about this and is including them in the comparison.
However GNU diff, treats these lines as incomplete and removes them from comparison.
php-diff:
@@ -1,12 +1,14 @@
-The Way that can be told of is not the eternal Way;
-The name that can be named is not the eternal name.
The Nameless is the origin of Heaven and Earth;
-The Named is the mother of all things.
+The named is the mother of all things.
+
Therefore let there always be non-being,
so we may see their subtlety,
And let there always be being,
so we may see their outcome.
The two are the same,
But after they are produced,
they have different names.
+They both may be called deep and profound.
+Deeper and more profound,
+The door of all subtleties!
Note:
above, the last line is the 'incomplete' line of the compared texts.
gnu-diff:
foo@bar:~$ diff -U 300 a.txt b.txt--- old.txt 2023-02-11 09:15:01.405933600 +0100+++ new.txt 2023-02-11 09:15:03.508578500 +0100@@ -1,11 +1,13 @@-The Way that can be told of is not the eternal Way;-The name that can be named is not the eternal name. The Nameless is the origin of Heaven and Earth;-The Named is the mother of all things.+The named is the mother of all things.+ Therefore let there always be non-being, so we may see their subtlety, And let there always be being, so we may see their outcome. The two are the same, But after they are produced, they have different names.+They both may be called deep and profound.+Deeper and more profound,+The door of all subtleties!foo@bar:~$
Note:
above, the line just above the prompt is a cli separator between the output from the previous command and this prompt.
The 'incomplete' lines are removed for comparison.
Notice the differences of the hunk info (between @@).
How do we want the php-diff library to behave, regarding mentioned difference between php-diff and GNU diff?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
See: https://www.gnu.org/software/diffutils/manual/html_node/Incomplete-Lines.html
In our example files, a and b contains a empty trailing line (a: 34, b: 33).
This library (and many other software) doesn't care about this and is including them in the comparison.
However GNU diff, treats these lines as incomplete and removes them from comparison.
php-diff:
Note:
above, the last line is the 'incomplete' line of the compared texts.
gnu-diff:
Note:
above, the line just above the prompt is a cli separator between the output from the previous command and this prompt.
The 'incomplete' lines are removed for comparison.
Notice the differences of the hunk info (between @@).
How do we want the php-diff library to behave, regarding mentioned difference between php-diff and GNU diff?
Beta Was this translation helpful? Give feedback.
All reactions