Line numbers changed between 1.3 and 1.4. This change is intentional, but in comparing the output against diff for the new examples provided it became clear that for unified and context diffs, the last hunk was reporting incorrect hunk lengths (that is, if it was 12,4 11,8, it should have been 12,3 11,7. This has been resolved by providing Diff::LCS::Hunk#diff an additional parameter, last which defaults to false.
Net new lines were added in the middle of a unified diff hunk, which was incorrect. That is, we were getting:
This has been resolved. The error was that Diff::LCS::Block#diff_size was applying .abs to its output, which is incorrect. We need to know the direction of the size for placing changes, but when determining the maximum block size for use in Diff::LCS::Hunk#diff calculations, we need to know the .abs size.
New tests were added to prevent these changes from regressing in the future, both as issue tests and as additional ldiff tests. These tests highlighted more issues with diff-lcs output as compared to diff, specifically the handling and reporting of missing newlines at the end of files. All of the issues highlighted were resolved and the structure of ldiff tests was changed so that it is easier to add new comparison files at any time.
Resolve #35: Indicate that when comparing against custom objects, #eql? must be implemented such that objects that resolve to the same meaning are treated as the same meaning. This is important because the basic LCS algorithm uses a hash for position matching.
Resolve #43: Provide a more meaningful error from Diff::LCS::Hunk.new if the piece provided does not create useful Diff::LCS::Block. It's extremely unlikely, this error will be more useful than NoMethodError being thrown.
Resolve #44: ldiff binary detection failed to work correctly. It had been !old_text or !new_text, but the precedence of or broke that. It is now !old_text || !new_text.
Also:
Ran Rubocop again. Updated configuration definitions, fixed some code formatting.
@JonRowe, this is going to fix an issue that RSpec may not have (because RSpec diffs tend to be small), but I wanted to get some input (still looking at test failures, so this is definitely still draft).
Resolve #65: Two different issues were reported:
Line numbers changed between 1.3 and 1.4. This change is intentional, but in comparing the output against
diff
for the new examples provided it became clear that for unified and context diffs, the last hunk was reporting incorrect hunk lengths (that is, if it was12,4 11,8
, it should have been12,3 11,7
. This has been resolved by providingDiff::LCS::Hunk#diff
an additional parameter,last
which defaults tofalse
.Net new lines were added in the middle of a unified diff hunk, which was incorrect. That is, we were getting:
instead of:
This has been resolved. The error was that
Diff::LCS::Block#diff_size
was applying.abs
to its output, which is incorrect. We need to know the direction of the size for placing changes, but when determining the maximum block size for use inDiff::LCS::Hunk#diff
calculations, we need to know the.abs
size.ldiff
tests. These tests highlighted more issues with diff-lcs output as compared todiff
, specifically the handling and reporting of missing newlines at the end of files. All of the issues highlighted were resolved and the structure ofldiff
tests was changed so that it is easier to add new comparison files at any time.Resolve #35: Indicate that when comparing against custom objects,
#eql?
must be implemented such that objects that resolve to the same meaning are treated as the same meaning. This is important because the basic LCS algorithm uses a hash for position matching.Resolve #43: Provide a more meaningful error from
Diff::LCS::Hunk.new
if thepiece
provided does not create usefulDiff::LCS::Block
. It's extremely unlikely, this error will be more useful thanNoMethodError
being thrown.Resolve #44:
ldiff
binary detection failed to work correctly. It had been!old_text or !new_text
, but the precedence ofor
broke that. It is now!old_text || !new_text
.Also: