summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--History.md17
-rw-r--r--diff-lcs.gemspec8
-rw-r--r--lib/diff/lcs.rb8
-rw-r--r--spec/traverse_sequences_spec.rb6
4 files changed, 25 insertions, 14 deletions
diff --git a/History.md b/History.md
index 5259045..e0905ae 100644
--- a/History.md
+++ b/History.md
@@ -1,12 +1,23 @@
# History
-## NEXT / YYYY-MM-DD
+## 1.5.0 / YYYY-MM-DD
- Updated the CI configuration and monkey-patch Hoe.
+- Kenichi Kamiya fixed a test configuration deprecation in SimpleCov. [#69]
+
- Tien corrected an off-by-one error when calculating an index value. [#71]
-- Kenichi Kamiya fixed a test configuration deprecation in SimpleCov. [#69]
+- Tien corrected an infinite loop case in the case where Diff::LCS would be
+ included into an enumerable class. [#73]
+
+- Tien corrected a bug that has existed more or less from the beginning of this
+ project where an off-by-one error was introduced, preventing the properly
+ transitive behaviour of `#traverse_sequences`. [#75]
+
+- Pre-releases
+
+ - 1.5.0.pre.1 / 2021-12-20
## 1.4.4 / 2020-07-01
@@ -327,3 +338,5 @@
[#65]: https://github.com/halostatue/diff-lcs/issues/65
[#69]: https://github.com/halostatue/diff-lcs/issues/69
[#71]: https://github.com/halostatue/diff-lcs/issues/71
+[#73]: https://github.com/halostatue/diff-lcs/issues/73
+[#75]: https://github.com/halostatue/diff-lcs/issues/75
diff --git a/diff-lcs.gemspec b/diff-lcs.gemspec
index 4b00fd0..e529805 100644
--- a/diff-lcs.gemspec
+++ b/diff-lcs.gemspec
@@ -1,15 +1,15 @@
# -*- encoding: utf-8 -*-
-# stub: diff-lcs 1.4.4 ruby lib
+# stub: diff-lcs 1.5.0.pre.1 ruby lib
Gem::Specification.new do |s|
s.name = "diff-lcs".freeze
- s.version = "1.4.4"
+ s.version = "1.5.0.pre.1"
- s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "bug_tracker_uri" => "https://github.com/halostatue/diff-lcs/issues", "homepage_uri" => "https://github.com/halostatue/diff-lcs", "source_code_uri" => "https://github.com/halostatue/diff-lcs" } if s.respond_to? :metadata=
s.require_paths = ["lib".freeze]
s.authors = ["Austin Ziegler".freeze]
- s.date = "2021-12-14"
+ s.date = "2021-12-20"
s.description = "Diff::LCS computes the difference between two Enumerable sequences using the\nMcIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities\nto create a simple HTML diff output format and a standard diff-like tool.\n\nThis is release 1.4.3, providing a simple extension that allows for\nDiff::LCS::Change objects to be treated implicitly as arrays and fixes a\nnumber of formatting issues.\n\nRuby versions below 2.5 are soft-deprecated, which means that older versions\nare no longer part of the CI test suite. If any changes have been introduced\nthat break those versions, bug reports and patches will be accepted, but it\nwill be up to the reporter to verify any fixes prior to release. The next\nmajor release will completely break compatibility.".freeze
s.email = ["halostatue@gmail.com".freeze]
s.executables = ["htmldiff".freeze, "ldiff".freeze]
diff --git a/lib/diff/lcs.rb b/lib/diff/lcs.rb
index 63888a1..43d3ce1 100644
--- a/lib/diff/lcs.rb
+++ b/lib/diff/lcs.rb
@@ -49,7 +49,7 @@ module Diff; end unless defined? Diff # rubocop:disable Style/Documentation
# a x b y c z p d q
# a b c a x b y c z
module Diff::LCS
- VERSION = '1.4.4'
+ VERSION = '1.5.0.pre.1'
end
require 'diff/lcs/callbacks'
@@ -85,14 +85,14 @@ module Diff::LCS # rubocop:disable Style/Documentation
# Traverses the discovered longest common subsequences between +self+ and
# +other+. See Diff::LCS#traverse_sequences.
def traverse_sequences(other, callbacks = nil, &block)
- traverse_sequences(self, other, callbacks || Diff::LCS::SequenceCallbacks, &block)
+ Diff::LCS.traverse_sequences(self, other, callbacks || Diff::LCS::SequenceCallbacks, &block)
end
# Traverses the discovered longest common subsequences between +self+ and
# +other+ using the alternate, balanced algorithm. See
# Diff::LCS#traverse_balanced.
def traverse_balanced(other, callbacks = nil, &block)
- traverse_balanced(self, other, callbacks || Diff::LCS::BalancedCallbacks, &block)
+ Diff::LCS.traverse_balanced(self, other, callbacks || Diff::LCS::BalancedCallbacks, &block)
end
# Attempts to patch +self+ with the provided +patchset+. A new sequence based
@@ -292,7 +292,7 @@ class << Diff::LCS
b_size = seq2.size
ai = bj = 0
- (0..matches.size).each do |i|
+ (0...matches.size).each do |i|
b_line = matches[i]
ax = string ? seq1[i, 1] : seq1[i]
diff --git a/spec/traverse_sequences_spec.rb b/spec/traverse_sequences_spec.rb
index ea7a129..b185e1d 100644
--- a/spec/traverse_sequences_spec.rb
+++ b/spec/traverse_sequences_spec.rb
@@ -127,13 +127,11 @@ describe 'Diff::LCS.traverse_sequences' do
end
it 'has done markers differently-sized sequences' do
- expect(@callback_s1_s2.done_a).to eq([['p', 9, 's', 10]])
+ expect(@callback_s1_s2.done_a).to eq([['p', 9, 't', 11]])
expect(@callback_s1_s2.done_b).to be_empty
- # 20110731 I don't yet understand why this particular behaviour
- # isn't transitive.
expect(@callback_s2_s1.done_a).to be_empty
- expect(@callback_s2_s1.done_b).to be_empty
+ expect(@callback_s2_s1.done_b).to eq([['t', 11, 'p', 9]])
end
end
end