summaryrefslogtreecommitdiff
path: root/History.md
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2020-07-01 12:39:56 -0400
committerAustin Ziegler <austin@zieglers.ca>2020-07-01 12:39:56 -0400
commitb75e0bddacd6915289c1e0868571f9501e4a1529 (patch)
tree9e4c6373221a47eb3bbe8e8277b6d5839a46a029 /History.md
parent60613d2af564a93dc5c19c8a71c3f674a5db6fdb (diff)
downloaddiff-lcs-b75e0bddacd6915289c1e0868571f9501e4a1529.tar.gz
diff-lcs 1.4.4 - Fix broken formattingmisplaced-chunk-issue-65
- 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 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: ```diff @@ -10,6 +11,10 @@ recipe[j::default] recipe[k::default] recipe[l::default] +recipe[o::new] +recipe[p::new] +recipe[q::new] +recipe[r::new] recipe[m::default] recipe[n::default] ``` instead of: ```diff @@ -12,3 +11,7 @@ recipe[l::default] recipe[m::default] recipe[n::default] +recipe[o::new] +recipe[p::new] +recipe[q::new] +recipe[r::new] ``` 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.
Diffstat (limited to 'History.md')
-rw-r--r--History.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/History.md b/History.md
index 3690990..063387b 100644
--- a/History.md
+++ b/History.md
@@ -8,8 +8,35 @@
a more useful exception. [#43][]
- Added documentation that should address custom object issues as reported in
[#35][].
+
- Fixed more diff errors, in part reported in [#65][].
+ - The use of `Numeric#abs` is incorrect in `Diff::LCS::Block#diff_size`.
+ The diff size _must_ be accurate for correct change placement.
+ - When selecting @max_diff_size in Diff::LCS::Hunk, choose it based on
+ `block.diff_size.abs`.
+ - Made a number of changes that will, unfortunately, increase allocations
+ at the cost of being safe with frozen strings.
+ - Add some knowledge that when `Diff::LCS::Hunk#diff` is called, that we
+ are processing the _last_ hunk, so some changes will be made to how the
+ output is generated.
+
+ - `old`, `ed`, and `reverse_ed` formats have no differences.
+ - `unified` format will report `\ No newline at end of file` given the
+ correct conditions, at most once. Unified range reporting also
+ differs for the last hunk such that the `length` of the range is
+ reduced by one.
+ - `context` format will report `\No newline at end of file` given the
+ correct conditions, up to once per "file". Context range reporting also
+ differs for the last hunk such that the `end` part of the range is
+ reduced by one to a minimum of one.
+
+- Added a bunch more tests for the cases above, and fixed `hunk_spec.rb` so
+ that the phrase being compared isn't nonsense French.
+
+- Updated formatting.
+- Added a Rake task to assist with manual testing on Ruby 1.8.
+
## 1.4.3 / 2020-06-29
- Fixed several issues with the 1.4 on Rubies older than 2.0. Some of this was