Skip to content

Conversation

@halostatue
Copy link
Owner

@halostatue halostatue commented Dec 31, 2025

This prepares for the release of diff-lcs 2.0 beta 1. This version makes Ruby 3.2 the minimum supported version, allowing for significant modernization and breaking changes.

With modern Ruby support, we get:

  • readability improvements (endless methods, pattern matching);

  • support for immutable Data classes (Diff::LCS::Block, Diff::LCS::Change, and Diff::LCS::ContextChange);

  • removal of compatibility shims;

  • reduction in conditional tests in loops, especially for String character extraction (compare string ? seq[i, 1] : seq[i] to seq[i]); and

  • optimizations to string and relying on standard encoding support present since Ruby 2.1.

The primary API (methods and class methods on Diff::LCS) has not changed, with one exception noted below. Internal APIs (including Diff::LCS::Block, Diff::LCS::Change, Diff::LCS::ContextChange, and Diff::LCS::Hunk) have changed for compatibility.

Additionally:

  • The htmldiff binary and supporting code have been removed without replacement.

  • ldiff no longer supports ed-script output (ed and reverse_ed formats). As Baptiste Courtois says in Drop ed & reverse_ed formats #108, the "implementation was broken for a while and no-one reported it."

  • The method Diff::LCS.LCS has been removed as an alias for Diff::LCS.lcs. Most callers are using Diff::LCS.lcs and modern Ruby did-you-mean support should assist with this update.

Release Timeline

This is a development release (2.0.0.beta.1) to allow downstream consumers (especially RSpec) time to test compatibility before the final 2.0 release in January 2026.

@coveralls
Copy link

coveralls commented Dec 31, 2025

Coverage Status

coverage: 91.336% (+3.0%) from 88.366%
when pulling 1d93a09 on prepare-for-2
into 9b507ea on main.

halostatue and others added 11 commits December 31, 2025 13:11
Breaking-Change: The htmldiff binary and support code have been removed without replacement.
Signed-off-by: Austin Ziegler <[email protected]>
With Ruby 3.2 as the minimum supported version, compatibility shims for older
Ruby versions are no longer needed.

Breaking-Change: Removed backports.rb which provided compatibility for older Ruby versions.
Signed-off-by: Austin Ziegler <[email protected]>
These formats are super old and very unlikely used. Their implementation
was broken for a while and no-one reported it.

The GNU doc say that ed format is "almost obsolete". [1]
The reverse_ed (aka forward-ed) is described as "not very useful". [2]

[1]: https://www.gnu.org/software/diffutils/manual/html_node/ed-Scripts.html
[2]: https://www.gnu.org/software/diffutils/manual/html_node/Forward-ed.html

Resolves: #108
Breaking-Change: The ed and reverse_ed output formats are no longer supported in ldiff.
Signed-off-by: Austin Ziegler <[email protected]>
Signed-off-by: Austin Ziegler <[email protected]>
Modernized Block class using Ruby 3.2+ Data class for immutability and
better performance. The constructor is private; use from_chunk instead.

Breaking-Change: Block is immutable; new is private, from_chunk instead
Signed-off-by: Austin Ziegler <[email protected]>
Modernized `Diff::LCS::Change` and `Diff::LCS::ContextChange` using
immutable Data classes.

Breaking-Change: change objects are immutable
Signed-off-by: Austin Ziegler <[email protected]>
Signed-off-by: Austin Ziegler <[email protected]>
Optimized hunk processing by caching encoding-related strings and
removing unnecessary encoding detection conditionals.

Signed-off-by: Austin Ziegler <[email protected]>
Applied modern Ruby design and simplified implementation around string
enumerable sequences.

Signed-off-by: Austin Ziegler <[email protected]>
Simplified string enumerable sequence handling.

Signed-off-by: Austin Ziegler <[email protected]>
Simplified build tooling, updated GitHub Actions workflows, prepared
changelog for dev release, and updated support for Ruby 3.2 through 4.x.

- Streamlined Rakefile and Gemfile and removed unnecessary complexity
- Added Ruby 4.0 support and dropped unsupported Ruby versions
- Simplified CI configuration
- Updated release and support documents.

Signed-off-by: Austin Ziegler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants