diff-lcs 1.6.2 → 2.0.0.beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +65 -4
  3. data/CONTRIBUTING.md +91 -35
  4. data/CONTRIBUTORS.md +19 -9
  5. data/LICENCE.md +39 -11
  6. data/Manifest.txt +91 -83
  7. data/README.md +13 -9
  8. data/Rakefile +99 -73
  9. data/SECURITY.md +22 -27
  10. data/integration/compare/array_diff_spec.rb +10 -0
  11. data/integration/compare/hash_diff_spec.rb +25 -0
  12. data/integration/compare/string_diff_spec.rb +10 -0
  13. data/integration/rspec_differ_spec.rb +26 -0
  14. data/integration/rspec_expectations_spec.rb +32 -0
  15. data/integration/runner +20 -0
  16. data/lib/diff/lcs/block.rb +29 -24
  17. data/lib/diff/lcs/callbacks.rb +240 -242
  18. data/lib/diff/lcs/change.rb +102 -104
  19. data/lib/diff/lcs/hunk.rb +92 -155
  20. data/lib/diff/lcs/internals.rb +92 -96
  21. data/lib/diff/lcs/ldiff.rb +30 -38
  22. data/lib/diff/lcs/version.rb +1 -1
  23. data/lib/diff/lcs.rb +439 -466
  24. data/licenses/dco.txt +34 -0
  25. data/spec/hunk_spec.rb +32 -45
  26. data/spec/lcs_spec.rb +6 -6
  27. data/spec/ldiff_spec.rb +8 -8
  28. data/spec/spec_helper.rb +17 -27
  29. data/test/fixtures/ldiff/output.diff-c +7 -0
  30. data/test/fixtures/ldiff/output.diff-u +5 -0
  31. data/test/fixtures/ldiff/output.diff.bin2 +1 -0
  32. data/test/fixtures/ldiff/output.diff.bin2-c +1 -0
  33. data/test/fixtures/ldiff/output.diff.bin2-e +1 -0
  34. data/test/fixtures/ldiff/output.diff.bin2-f +1 -0
  35. data/test/fixtures/ldiff/output.diff.bin2-u +1 -0
  36. data/{spec → test}/fixtures/ldiff/output.diff.chef-c +2 -2
  37. data/test/fixtures/ldiff/output.diff.chef-u +9 -0
  38. data/{spec → test}/fixtures/ldiff/output.diff.chef2-c +2 -2
  39. data/{spec → test}/fixtures/ldiff/output.diff.chef2-u +2 -2
  40. data/test/fixtures/ldiff/output.diff.empty.vs.four_lines-c +9 -0
  41. data/test/fixtures/ldiff/output.diff.empty.vs.four_lines-u +7 -0
  42. data/test/fixtures/ldiff/output.diff.four_lines.vs.empty-c +9 -0
  43. data/test/fixtures/ldiff/output.diff.four_lines.vs.empty-u +7 -0
  44. data/test/fixtures/ldiff/output.diff.issue95_trailing_context-c +9 -0
  45. data/test/fixtures/ldiff/output.diff.issue95_trailing_context-u +6 -0
  46. data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line1-c +2 -2
  47. data/test/fixtures/ldiff/output.diff.missing_new_line1-u +9 -0
  48. data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line2-c +2 -2
  49. data/test/fixtures/ldiff/output.diff.missing_new_line2-u +9 -0
  50. data/test/test_block.rb +34 -0
  51. data/test/test_change.rb +234 -0
  52. data/test/test_diff.rb +53 -0
  53. data/test/test_helper.rb +225 -0
  54. data/test/test_hunk.rb +72 -0
  55. data/test/test_issues.rb +168 -0
  56. data/test/test_lcs.rb +47 -0
  57. data/test/test_ldiff.rb +89 -0
  58. data/test/test_patch.rb +362 -0
  59. data/test/test_sdiff.rb +167 -0
  60. data/test/test_traverse_balanced.rb +322 -0
  61. data/test/test_traverse_sequences.rb +187 -0
  62. metadata +199 -110
  63. data/.rspec +0 -1
  64. data/bin/htmldiff +0 -35
  65. data/lib/diff/lcs/backports.rb +0 -13
  66. data/lib/diff/lcs/htmldiff.rb +0 -160
  67. data/mise.toml +0 -5
  68. data/spec/fixtures/ldiff/output.diff-c +0 -7
  69. data/spec/fixtures/ldiff/output.diff-e +0 -3
  70. data/spec/fixtures/ldiff/output.diff-f +0 -3
  71. data/spec/fixtures/ldiff/output.diff-u +0 -5
  72. data/spec/fixtures/ldiff/output.diff.bin2 +0 -1
  73. data/spec/fixtures/ldiff/output.diff.bin2-c +0 -1
  74. data/spec/fixtures/ldiff/output.diff.bin2-e +0 -1
  75. data/spec/fixtures/ldiff/output.diff.bin2-f +0 -1
  76. data/spec/fixtures/ldiff/output.diff.bin2-u +0 -1
  77. data/spec/fixtures/ldiff/output.diff.chef-e +0 -3
  78. data/spec/fixtures/ldiff/output.diff.chef-f +0 -3
  79. data/spec/fixtures/ldiff/output.diff.chef-u +0 -9
  80. data/spec/fixtures/ldiff/output.diff.chef2-e +0 -7
  81. data/spec/fixtures/ldiff/output.diff.chef2-f +0 -7
  82. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-c +0 -9
  83. data/spec/fixtures/ldiff/output.diff.empty.vs.four_lines-u +0 -7
  84. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-c +0 -9
  85. data/spec/fixtures/ldiff/output.diff.four_lines.vs.empty-u +0 -7
  86. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-c +0 -9
  87. data/spec/fixtures/ldiff/output.diff.issue95_trailing_context-u +0 -6
  88. data/spec/fixtures/ldiff/output.diff.missing_new_line1-u +0 -9
  89. data/spec/fixtures/ldiff/output.diff.missing_new_line2-u +0 -9
  90. /data/{docs → licenses}/COPYING.txt +0 -0
  91. /data/{docs → licenses}/artistic.txt +0 -0
  92. /data/{spec → test}/fixtures/123_x +0 -0
  93. /data/{spec → test}/fixtures/456_x +0 -0
  94. /data/{spec → test}/fixtures/aX +0 -0
  95. /data/{spec → test}/fixtures/bXaX +0 -0
  96. /data/{spec → test}/fixtures/ds1.csv +0 -0
  97. /data/{spec → test}/fixtures/ds2.csv +0 -0
  98. /data/{spec → test}/fixtures/empty +0 -0
  99. /data/{spec → test}/fixtures/file1.bin +0 -0
  100. /data/{spec → test}/fixtures/file2.bin +0 -0
  101. /data/{spec → test}/fixtures/four_lines +0 -0
  102. /data/{spec → test}/fixtures/four_lines_with_missing_new_line +0 -0
  103. /data/{spec → test}/fixtures/ldiff/diff.missing_new_line1-e +0 -0
  104. /data/{spec → test}/fixtures/ldiff/diff.missing_new_line1-f +0 -0
  105. /data/{spec → test}/fixtures/ldiff/diff.missing_new_line2-e +0 -0
  106. /data/{spec → test}/fixtures/ldiff/diff.missing_new_line2-f +0 -0
  107. /data/{spec → test}/fixtures/ldiff/error.diff.chef-e +0 -0
  108. /data/{spec → test}/fixtures/ldiff/error.diff.chef-f +0 -0
  109. /data/{spec → test}/fixtures/ldiff/error.diff.missing_new_line1-e +0 -0
  110. /data/{spec → test}/fixtures/ldiff/error.diff.missing_new_line1-f +0 -0
  111. /data/{spec → test}/fixtures/ldiff/error.diff.missing_new_line2-e +0 -0
  112. /data/{spec → test}/fixtures/ldiff/error.diff.missing_new_line2-f +0 -0
  113. /data/{spec → test}/fixtures/ldiff/output.diff +0 -0
  114. /data/{spec → test}/fixtures/ldiff/output.diff.bin1 +0 -0
  115. /data/{spec → test}/fixtures/ldiff/output.diff.bin1-c +0 -0
  116. /data/{spec → test}/fixtures/ldiff/output.diff.bin1-e +0 -0
  117. /data/{spec → test}/fixtures/ldiff/output.diff.bin1-f +0 -0
  118. /data/{spec → test}/fixtures/ldiff/output.diff.bin1-u +0 -0
  119. /data/{spec → test}/fixtures/ldiff/output.diff.chef +0 -0
  120. /data/{spec → test}/fixtures/ldiff/output.diff.chef2 +0 -0
  121. /data/{spec → test}/fixtures/ldiff/output.diff.chef2-d +0 -0
  122. /data/{spec → test}/fixtures/ldiff/output.diff.empty.vs.four_lines +0 -0
  123. /data/{spec → test}/fixtures/ldiff/output.diff.empty.vs.four_lines-e +0 -0
  124. /data/{spec → test}/fixtures/ldiff/output.diff.empty.vs.four_lines-f +0 -0
  125. /data/{spec → test}/fixtures/ldiff/output.diff.four_lines.vs.empty +0 -0
  126. /data/{spec → test}/fixtures/ldiff/output.diff.four_lines.vs.empty-e +0 -0
  127. /data/{spec → test}/fixtures/ldiff/output.diff.four_lines.vs.empty-f +0 -0
  128. /data/{spec → test}/fixtures/ldiff/output.diff.issue95_trailing_context +0 -0
  129. /data/{spec → test}/fixtures/ldiff/output.diff.issue95_trailing_context-e +0 -0
  130. /data/{spec → test}/fixtures/ldiff/output.diff.issue95_trailing_context-f +0 -0
  131. /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line1 +0 -0
  132. /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line1-e +0 -0
  133. /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line1-f +0 -0
  134. /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line2 +0 -0
  135. /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line2-e +0 -0
  136. /data/{spec → test}/fixtures/ldiff/output.diff.missing_new_line2-f +0 -0
  137. /data/{spec → test}/fixtures/new-chef +0 -0
  138. /data/{spec → test}/fixtures/new-chef2 +0 -0
  139. /data/{spec → test}/fixtures/old-chef +0 -0
  140. /data/{spec → test}/fixtures/old-chef2 +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34fc249139fb5ed40b525cf33d8e4e3d3702384f74d1e67e63d8eed54a09133c
4
- data.tar.gz: 46739e6b242db46dd6d01c4bb26d7c51fc07ccaebd7ecd58c305d758f30dfc33
3
+ metadata.gz: fb47e6f9ca29177bf13307762b66d1dc6daa799440bb52791dab584bc7ad1258
4
+ data.tar.gz: 572a4b3da413bc87eebbc36dfd7d1b66002c28e9e126784f6c74f3516047c96f
5
5
  SHA512:
6
- metadata.gz: c482d6b11cb38b840ee4a4c11785c592a7a537e5f855cca99739a578e8d833b05ad43cba4ac8e40e4ae1fa876633d9d96c18c29acef63bf72532c352d98b05e6
7
- data.tar.gz: 7c6da2681b6a2ddf4ebda85deb24aeaeea29218cfa452d40717e1963c117c95230da2c01c18b806cb0916a804263aa7ac0230c4adcbb8fb1b30a95faee5a4dda
6
+ metadata.gz: 837bfe7fcbdfb8d79946e60006d804ac3ed7ebe1a312525e51124ae34fe83a295b25b58a0b16e0e588e396563fb2b544540e98d10602afeaa42af360663e70e1
7
+ data.tar.gz: 671e433b132c818058850eb30a90309e603e6edff7472ee411129e40a81ad7ca5976f224f7924d4572c31eba283e8c40c64ec97b0fd5e9cf02651844235df3ce
data/CHANGELOG.md CHANGED
@@ -1,5 +1,61 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.0.beta.2 / 2025-01-22
4
+
5
+ This release has significant **breaking changes**.
6
+
7
+ - diff-lcs 2 supports Ruby 3.2 or higher. This allowed:
8
+
9
+ - readability improvements (endless methods, pattern matching);
10
+
11
+ - support for immutable Data classes (`Diff::LCS::Block`, `Diff::LCS::Change`,
12
+ and `Diff::LCS::ContextChange`);
13
+
14
+ - removal of compatibility shims;
15
+
16
+ - reduction in conditional tests in loops, especially for String character
17
+ extraction (compare `string ? seq[i, 1] : seq[i]` to `seq[i]`); and
18
+
19
+ - optimizations to string and relying on standard encoding support present
20
+ since Ruby 2.1.
21
+
22
+ The primary API (methods and class methods on `Diff::LCS`) has not changed,
23
+ with one exception noted below. Internal APIs (including `Diff::LCS::Block`,
24
+ `Diff::LCS::Change`, `Diff::LCS::ContextChange`, and `Diff::LCS::Hunk`) have
25
+ changed for compatibility.
26
+
27
+ - The `htmldiff` binary and supporting code have been removed without
28
+ replacement.
29
+
30
+ - `ldiff` no longer supports `ed`-script output (`ed` and `reverse_ed` formats).
31
+ As Baptiste Courtois says in [#108][pull-108], the "implementation was broken
32
+ for a while and no-one reported it."
33
+
34
+ - The method `Diff::LCS.LCS` has been removed as an alias for `Diff::LCS.lcs`.
35
+ Most callers are using `Diff::LCS.lcs` and modern Ruby did-you-mean support
36
+ should assist with this update.
37
+
38
+ - `Diff::LCS::Change` objects implemented the comparison operator (`<=>`)
39
+ incorrectly. Comparisons are now done so that the `position` is compared
40
+ first, then the `action` (by index of `VALID_ACTIONS`), and finally the
41
+ element. `Diff::LCS::ContextChange` works similarly, comparing the old and new
42
+ positions prior to comparing the actions by index.
43
+
44
+ The order of `VALID_ACTIONS` was changed for the index order to make sense.
45
+
46
+ - `ldiff` now implements `-` as a filename option for standard input. This is
47
+ used for integration testing with RSpec like this:
48
+
49
+ ```console
50
+ rspec -Ilib -rdiff/lcs integration/failure/array_diff_spec.rb 2>&1 |
51
+ ruby -Ilib bin/ldiff -U integration/golden/array_diff.txt -
52
+ ```
53
+
54
+ - diff-lcs no longer uses RSpec as its test suite, but instead uses Minitest.
55
+ The conversion to Minitest and the new RSpec integration tests
56
+ (`rake integration`) were written with the assistance of [Kiro][kiro] and
57
+ verified manually, with portions changed as required.
58
+
3
59
  ## 1.6.2 / 2025-05-12
4
60
 
5
61
  - Handle upcoming changes to the `cgi` gem in Ruby 3.5 ([#147][pull-147])
@@ -25,8 +81,9 @@
25
81
 
26
82
  ## 1.6.0 / 2025-02-13
27
83
 
28
- - Baptiste Courtois (@annih) has done significant work on making `bin/ldiff`
29
- work better, contributing a number of issues and pull requests. These include:
84
+ - Baptiste Courtois ([@annih][gh-user-annih]) has done significant work on
85
+ making `bin/ldiff` work better, contributing a number of issues and pull
86
+ requests. These include:
30
87
 
31
88
  - Separation of command parsing from diff-generation in `Diff::LCS::Ldiff`
32
89
  code extraction making it easier to use separately from the `bin/ldiff`
@@ -385,8 +442,8 @@
385
442
 
386
443
  ## 1.1.1 / 2004-09-25
387
444
 
388
- - Fixed bug #891 (Set returned from patch command does not contain last equal
389
- part).
445
+ - Fixed bug [#891][gh-issue-891] (Set returned from patch command does not
446
+ contain last equal part).
390
447
 
391
448
  - Fixed a problem with callback initialisation code (it assumed that all
392
449
  callbacks passed as classes can be initialised; now, it rescues NoMethodError
@@ -504,6 +561,7 @@
504
561
  [pull-103]: https://github.com/halostatue/diff-lcs/pull/103
505
562
  [pull-104]: https://github.com/halostatue/diff-lcs/pull/104
506
563
  [pull-105]: https://github.com/halostatue/diff-lcs/pull/105
564
+ [pull-108]: https://github.com/halostatue/diff-lcs/pull/108
507
565
  [pull-129]: https://github.com/halostatue/diff-lcs/pull/129
508
566
  [pull-147]: https://github.com/halostatue/diff-lcs/pull/147
509
567
  [pull-148]: https://github.com/halostatue/diff-lcs/pull/148
@@ -516,3 +574,6 @@
516
574
  [standard ruby]: https://github.com/standardrb/standard
517
575
  [tidelift]: https://tidelift.com/security
518
576
  [tp]: https://guides.rubygems.org/trusted-publishing/
577
+ [kiro]: https://kiro.dev
578
+ [gh-user-annih]: https://github.com/annih
579
+ [gh-issue-891]: https://github.com/halostatue/diff-lcs/issues/891
data/CONTRIBUTING.md CHANGED
@@ -1,31 +1,36 @@
1
1
  # Contributing
2
2
 
3
- Contribution to diff-lcs is encouraged in any form: a bug report, a feature
4
- request, or code contributions. There are a few DOs and DON'Ts for
5
- contributions.
3
+ Contribution to diff-lcs is encouraged: bug reports, feature requests, or code
4
+ contributions. New features should be proposed and discussed in an
5
+ [issue][issues].
6
6
 
7
- - DO:
7
+ Before contributing patches, please read the [Licence](./LICENCE.md).
8
8
 
9
- - Keep the coding style that already exists for any updated Ruby code (support
10
- or otherwise). I use [Standard Ruby][standardrb] for linting and formatting.
9
+ diff-lcs is governed under the [Contributor Covenant Code of Conduct][cccoc].
11
10
 
12
- - Use thoughtfully-named topic branches for contributions. Rebase your commits
13
- into logical chunks as necessary.
11
+ ## Code Guidelines
14
12
 
15
- - Use [quality commit messages][qcm].
13
+ I have several guidelines to contributing code through pull requests:
16
14
 
17
- - Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
18
- `CHANGELOG.md` as a separate commit from your main change. (Follow the style
19
- in the `CHANGELOG.md` and provide a link to your PR.)
15
+ - All code changes require tests. In most cases, this will be added or updated
16
+ unit tests. I use [Minitest][minitest].
20
17
 
21
- - Add or update tests as appropriate for your change. The test suite is
22
- written in [RSpec][rspec].
18
+ - There are integration tests with RSpec which must not be broken, accessible
19
+ through `rake integration`. This requires a non-bundled RSpec,
20
+ `gem install rspec`.
23
21
 
24
- - Add or update documentation as appropriate for your change. The
25
- documentation is RDoc; diff-lcs does not use extensions that may be present
26
- in alternative documentation generators.
22
+ - I use code formatters, static analysis tools, and linting to ensure consistent
23
+ styles and formatting. There should be no warning output from test run
24
+ processes. I use [Standard Ruby][standardrb].
27
25
 
28
- - DO NOT:
26
+ - Proposed changes should be on a thoughtfully-named topic branch and organized
27
+ into logical commit chunks as appropriate.
28
+
29
+ - Use [Conventional Commits][conventional] with my
30
+ [conventions](#commit-conventions).
31
+
32
+ - Versions must not be updated in pull requests unless otherwise directed. This
33
+ means that you must not:
29
34
 
30
35
  - Modify `VERSION` in `lib/diff/lcs/version.rb`. When your patch is accepted
31
36
  and a release is made, the version will be updated at that point.
@@ -36,6 +41,30 @@ contributions.
36
41
 
37
42
  - Modify the `Gemfile`.
38
43
 
44
+ - Documentation should be added or updated as appropriate for new or updated
45
+ functionality. The documentation is RDoc; diff-lcs does not use extensions
46
+ that may be present in alternative documentation generators.
47
+
48
+ - All GitHub Actions checks marked as required must pass before a pull request
49
+ may be accepted and merged.
50
+
51
+ - Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
52
+ `CHANGELOG.md` as a separate commit from your main change. (Follow the style
53
+ in the `CHANGELOG.md` and provide a link to your PR.)
54
+
55
+ - Include your DCO sign-off in each commit message (see [LICENCE](LICENCE.md)).
56
+
57
+ ## AI Contribution Policy
58
+
59
+ diff-lcs is a library with complex interactions and subtle decisions (some of
60
+ them possibly even wrong). It is extremely important that contributions of any
61
+ sort be well understood by the submitter and that the developer can attest to
62
+ the [Developer Certificate of Origin][dco] for each pull request (see
63
+ [LICENCE](LICENCE.md)).
64
+
65
+ Any contribution (bug, feature request, or pull request) that uses undeclared AI
66
+ output will be rejected.
67
+
39
68
  ## Test Dependencies
40
69
 
41
70
  diff-lcs uses Ryan Davis's [Hoe][Hoe] to manage the release process, and it adds
@@ -44,28 +73,55 @@ tests in the same way that `rake spec` does.
44
73
 
45
74
  To assist with the installation of the development dependencies for diff-lcs, I
46
75
  have provided a Gemfile pointing to the (generated) `diff-lcs.gemspec` file.
47
- `minitar.gemspec` file. This will permit you to use `bundle install` to install
48
- the dependencies.
76
+ This will permit you to use `bundle install` to install the dependencies.
49
77
 
50
78
  You can run tests with code coverage analysis by running `rake spec:coverage`.
51
79
 
52
- ## Workflow
80
+ ## Commit Conventions
81
+
82
+ diff-lcs has adopted a variation of the Conventional Commits format for commit
83
+ messages. The following types are permitted:
84
+
85
+ | Type | Purpose |
86
+ | ------- | ----------------------------------------------------- |
87
+ | `feat` | A new feature |
88
+ | `fix` | A bug fix |
89
+ | `chore` | A code change that is neither a bug fix nor a feature |
90
+ | `docs` | Documentation updates |
91
+ | `deps` | Dependency updates, including GitHub Actions. |
92
+
93
+ I encourage the use of [Tim Pope's][tpope-qcm] or [Chris Beam's][cbeams]
94
+ guidelines on the writing of commit messages
95
+
96
+ I require the use of [git][trailers1] [trailers][trailers2] for specific
97
+ additional metadata and strongly encourage it for others. The conditionally
98
+ required metadata trailers are:
99
+
100
+ - `Breaking-Change`: if the change is a breaking change. **Do not** use the
101
+ shorthand form (`feat!(scope)`) or `BREAKING CHANGE`.
102
+
103
+ - `Signed-off-by`: this is required for all developers except me, as outlined in
104
+ the [Licence](./LICENCE.md#developer-certificate-of-origin).
53
105
 
54
- Here's the most direct way to get your work merged into the project:
106
+ - `Fixes` or `Resolves`: If a change fixes one or more open [issues][issues],
107
+ that issue must be included in the `Fixes` or `Resolves` trailer. Multiple
108
+ issues should be listed comma separated in the same trailer:
109
+ `Fixes: #1, #5, #7`, but _may_ appear in separate trailers. While both `Fixes`
110
+ and `Resolves` are synonyms, only _one_ should be used in a given commit or
111
+ pull request.
55
112
 
56
- - Fork the project.
57
- - Clone your fork (`git clone git://github.com/<username>/diff-lcs.git`).
58
- - Create a topic branch to contain your change
59
- (`git checkout -b my_awesome_feature`).
60
- - Hack away, add tests. Not necessarily in that order.
61
- - Make sure everything still passes by running `rake`.
62
- - If necessary, rebase your commits into logical chunks, without errors.
63
- - Push the branch up (`git push origin my_awesome_feature`).
64
- - Create a pull request against halostatue/diff-lcs and describe what your
65
- change does and the why you think it should be merged.
113
+ - `Related to`: If a change does not fix an issue, those issue references should
114
+ be included in this trailer.
66
115
 
116
+ [cbeams]: https://cbea.ms/git-commit/
117
+ [cccoc]: ./CODE_OF_CONDUCT.md
118
+ [conventional]: https://www.conventionalcommits.org/en/v1.0.0/
119
+ [dco]: licences/dco.txt
67
120
  [hoe]: https://github.com/seattlerb/hoe
68
- [qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
69
- [release-gem]: https://github.com/rubygems/release-gem
70
- [rspec]: http://rspec.info/documentation/
121
+ [issues]: https://github.com/halostatue/diff-lcs/issues
122
+ [minitest]: https://github.com/seattlerb/minitest
123
+ [rspec]: https://rspec.info/documentation/
71
124
  [standardrb]: https://github.com/standardrb/standard
125
+ [tpope-qcm]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
126
+ [trailers1]: https://git-scm.com/docs/git-interpret-trailers
127
+ [trailers2]: https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---trailerlttokengtltvaluegt
data/CONTRIBUTORS.md CHANGED
@@ -1,26 +1,26 @@
1
1
  # Contributors
2
2
 
3
- - Austin Ziegler (@halostatue) created diff-lcs.
3
+ - Austin Ziegler ([@halostatue][gh-user-halostatue]) created diff-lcs.
4
4
 
5
5
  Thanks to everyone else who has contributed to diff-lcs over the years:
6
6
 
7
- - @ginriki
8
- - @joshbronson
9
- - @kevinmook
10
- - @mckaz
7
+ - [@ginriki][gh-user-ginriki]
8
+ - [@joshbronson][gh-user-joshbronson]
9
+ - [@kevinmook][gh-user-kevinmook]
10
+ - [@mckaz][gh-user-mckaz]
11
11
  - Akinori Musha
12
12
  - Artem Ignatyev
13
13
  - Brandon Fish
14
- - Baptiste Courtois (@annih)
14
+ - Baptiste Courtois ([@annih][gh-user-annih])
15
15
  - Camille Drapier
16
16
  - Cédric Boutillier
17
- - @earlopain
17
+ - [@earlopain][gh-user-earlopain]
18
18
  - Gregg Kellogg
19
19
  - Jagdeep Singh
20
20
  - Jason Gladish
21
21
  - Jon Rowe
22
22
  - Josef Strzibny
23
- - Josep (@apuratepp)
23
+ - Josep ([@apuratepp][gh-user-apuratepp])
24
24
  - Josh Bronson
25
25
  - Jun Aruga
26
26
  - Justin Steele
@@ -44,6 +44,16 @@ Thanks to everyone else who has contributed to diff-lcs over the years:
44
44
  - Ryan Lovelett
45
45
  - Scott Steele
46
46
  - Simon Courtois
47
- - Tien (@tiendo1011)
47
+ - Tien ([@tiendo1011][gh-user-tiendo1011])
48
48
  - Tomas Jura
49
49
  - Vít Ondruch
50
+
51
+ [gh-user-halostatue]: https://github.com/halostatue
52
+ [gh-user-ginriki]: https://github.com/ginriki
53
+ [gh-user-joshbronson]: https://github.com/joshbronson
54
+ [gh-user-kevinmook]: https://github.com/kevinmook
55
+ [gh-user-mckaz]: https://github.com/mckaz
56
+ [gh-user-annih]: https://github.com/annih
57
+ [gh-user-earlopain]: https://github.com/earlopain
58
+ [gh-user-apuratepp]: https://github.com/apuratepp
59
+ [gh-user-tiendo1011]: https://github.com/tiendo1011
data/LICENCE.md CHANGED
@@ -1,14 +1,17 @@
1
1
  # Licence
2
2
 
3
- This software is available under three licenses: the GNU GPL version 2 (or at
4
- your option, a later version), the Perl Artistic license, or the MIT license.
5
- Note that my preference for licensing is the MIT license, but Algorithm::Diff
6
- was dually originally licensed with the Perl Artistic and the GNU GPL ("the same
7
- terms as Perl itself") and given that the Ruby implementation originally hewed
8
- pretty closely to the Perl version, I must maintain the additional licensing
9
- terms.
10
-
11
- - Copyright 2004–2025 Austin Ziegler and contributors.
3
+ - SPDX-License-Identifier: [MIT][mit] OR [GPL-2.0-or-later][gpl2-or-later] OR
4
+ [Artistic-1.0-Perl][artistic-perl]
5
+
6
+ This software is available under three disjunctive licences: the GNU GPL version
7
+ 2 (or at your option, a later version), the Perl Artistic license, or the MIT
8
+ license. Note that my preference for licensing is the MIT license, but
9
+ Algorithm::Diff was dually originally licensed with the Perl Artistic and the
10
+ GNU GPL ("the same terms as Perl itself") and given that the Ruby implementation
11
+ originally hewed pretty closely to the Perl version, I must maintain the
12
+ additional licensing terms.
13
+
14
+ - Copyright 2004-2026 Austin Ziegler and contributors.
12
15
  - Adapted from Algorithm::Diff (Perl) by Ned Konz and a Smalltalk version by
13
16
  Mario I. Wolczko.
14
17
 
@@ -33,8 +36,33 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
36
 
34
37
  ## Perl Artistic License
35
38
 
36
- See the file docs/artistic.txt in the main distribution.
39
+ See [licences/artistic.txt](licences/artistic.txt) in the main distribution.
37
40
 
38
41
  ## GNU GPL version 2
39
42
 
40
- See the file docs/COPYING.txt in the main distribution.
43
+ See the file [licences/COPYING.txt](licences/COPYING.txt) in the main
44
+ distribution.
45
+
46
+ ## Developer Certificate of Origin
47
+
48
+ All contributors **must** certify they are willing and able to provide their
49
+ contributions under the terms of _all_ of this project's licences with the
50
+ certification of the [Developer Certificate of Origin (Version 1.1)][dco].
51
+
52
+ Such certification is provided by ensuring that a `Signed-off-by`
53
+ [commit trailer][trailer] is present on every commit:
54
+
55
+ Signed-off-by: FirstName LastName <email@example.org>
56
+
57
+ The `Signed-off-by` trailer can be automatically added by git with the `-s` or
58
+ `--signoff` option on `git commit`:
59
+
60
+ ```sh
61
+ git commit --signoff
62
+ ```
63
+
64
+ [artistic-perl]: https://spdx.org/licenses/Artistic-1.0-Perl.html
65
+ [gpl2-or-later]: https://spdx.org/licenses/GPL-2.0-or-later.html
66
+ [mit]: https://spdx.org/licenses/MIT.html
67
+ [trailer]: https://git-scm.com/docs/git-interpret-trailers
68
+ [dco]: licences/dco.txt
data/Manifest.txt CHANGED
@@ -1,4 +1,3 @@
1
- .rspec
2
1
  CHANGELOG.md
3
2
  CODE_OF_CONDUCT.md
4
3
  CONTRIBUTING.md
@@ -8,102 +7,29 @@ Manifest.txt
8
7
  README.md
9
8
  Rakefile
10
9
  SECURITY.md
11
- bin/htmldiff
12
10
  bin/ldiff
13
- docs/COPYING.txt
14
- docs/artistic.txt
11
+ integration/compare/array_diff_spec.rb
12
+ integration/compare/hash_diff_spec.rb
13
+ integration/compare/string_diff_spec.rb
14
+ integration/rspec_differ_spec.rb
15
+ integration/rspec_expectations_spec.rb
16
+ integration/runner
15
17
  lib/diff-lcs.rb
16
18
  lib/diff/lcs.rb
17
19
  lib/diff/lcs/array.rb
18
- lib/diff/lcs/backports.rb
19
20
  lib/diff/lcs/block.rb
20
21
  lib/diff/lcs/callbacks.rb
21
22
  lib/diff/lcs/change.rb
22
- lib/diff/lcs/htmldiff.rb
23
23
  lib/diff/lcs/hunk.rb
24
24
  lib/diff/lcs/internals.rb
25
25
  lib/diff/lcs/ldiff.rb
26
26
  lib/diff/lcs/string.rb
27
27
  lib/diff/lcs/version.rb
28
- mise.toml
28
+ licenses/COPYING.txt
29
+ licenses/artistic.txt
30
+ licenses/dco.txt
29
31
  spec/change_spec.rb
30
32
  spec/diff_spec.rb
31
- spec/fixtures/123_x
32
- spec/fixtures/456_x
33
- spec/fixtures/aX
34
- spec/fixtures/bXaX
35
- spec/fixtures/ds1.csv
36
- spec/fixtures/ds2.csv
37
- spec/fixtures/empty
38
- spec/fixtures/file1.bin
39
- spec/fixtures/file2.bin
40
- spec/fixtures/four_lines
41
- spec/fixtures/four_lines_with_missing_new_line
42
- spec/fixtures/ldiff/diff.missing_new_line1-e
43
- spec/fixtures/ldiff/diff.missing_new_line1-f
44
- spec/fixtures/ldiff/diff.missing_new_line2-e
45
- spec/fixtures/ldiff/diff.missing_new_line2-f
46
- spec/fixtures/ldiff/error.diff.chef-e
47
- spec/fixtures/ldiff/error.diff.chef-f
48
- spec/fixtures/ldiff/error.diff.missing_new_line1-e
49
- spec/fixtures/ldiff/error.diff.missing_new_line1-f
50
- spec/fixtures/ldiff/error.diff.missing_new_line2-e
51
- spec/fixtures/ldiff/error.diff.missing_new_line2-f
52
- spec/fixtures/ldiff/output.diff
53
- spec/fixtures/ldiff/output.diff-c
54
- spec/fixtures/ldiff/output.diff-e
55
- spec/fixtures/ldiff/output.diff-f
56
- spec/fixtures/ldiff/output.diff-u
57
- spec/fixtures/ldiff/output.diff.bin1
58
- spec/fixtures/ldiff/output.diff.bin1-c
59
- spec/fixtures/ldiff/output.diff.bin1-e
60
- spec/fixtures/ldiff/output.diff.bin1-f
61
- spec/fixtures/ldiff/output.diff.bin1-u
62
- spec/fixtures/ldiff/output.diff.bin2
63
- spec/fixtures/ldiff/output.diff.bin2-c
64
- spec/fixtures/ldiff/output.diff.bin2-e
65
- spec/fixtures/ldiff/output.diff.bin2-f
66
- spec/fixtures/ldiff/output.diff.bin2-u
67
- spec/fixtures/ldiff/output.diff.chef
68
- spec/fixtures/ldiff/output.diff.chef-c
69
- spec/fixtures/ldiff/output.diff.chef-e
70
- spec/fixtures/ldiff/output.diff.chef-f
71
- spec/fixtures/ldiff/output.diff.chef-u
72
- spec/fixtures/ldiff/output.diff.chef2
73
- spec/fixtures/ldiff/output.diff.chef2-c
74
- spec/fixtures/ldiff/output.diff.chef2-d
75
- spec/fixtures/ldiff/output.diff.chef2-e
76
- spec/fixtures/ldiff/output.diff.chef2-f
77
- spec/fixtures/ldiff/output.diff.chef2-u
78
- spec/fixtures/ldiff/output.diff.empty.vs.four_lines
79
- spec/fixtures/ldiff/output.diff.empty.vs.four_lines-c
80
- spec/fixtures/ldiff/output.diff.empty.vs.four_lines-e
81
- spec/fixtures/ldiff/output.diff.empty.vs.four_lines-f
82
- spec/fixtures/ldiff/output.diff.empty.vs.four_lines-u
83
- spec/fixtures/ldiff/output.diff.four_lines.vs.empty
84
- spec/fixtures/ldiff/output.diff.four_lines.vs.empty-c
85
- spec/fixtures/ldiff/output.diff.four_lines.vs.empty-e
86
- spec/fixtures/ldiff/output.diff.four_lines.vs.empty-f
87
- spec/fixtures/ldiff/output.diff.four_lines.vs.empty-u
88
- spec/fixtures/ldiff/output.diff.issue95_trailing_context
89
- spec/fixtures/ldiff/output.diff.issue95_trailing_context-c
90
- spec/fixtures/ldiff/output.diff.issue95_trailing_context-e
91
- spec/fixtures/ldiff/output.diff.issue95_trailing_context-f
92
- spec/fixtures/ldiff/output.diff.issue95_trailing_context-u
93
- spec/fixtures/ldiff/output.diff.missing_new_line1
94
- spec/fixtures/ldiff/output.diff.missing_new_line1-c
95
- spec/fixtures/ldiff/output.diff.missing_new_line1-e
96
- spec/fixtures/ldiff/output.diff.missing_new_line1-f
97
- spec/fixtures/ldiff/output.diff.missing_new_line1-u
98
- spec/fixtures/ldiff/output.diff.missing_new_line2
99
- spec/fixtures/ldiff/output.diff.missing_new_line2-c
100
- spec/fixtures/ldiff/output.diff.missing_new_line2-e
101
- spec/fixtures/ldiff/output.diff.missing_new_line2-f
102
- spec/fixtures/ldiff/output.diff.missing_new_line2-u
103
- spec/fixtures/new-chef
104
- spec/fixtures/new-chef2
105
- spec/fixtures/old-chef
106
- spec/fixtures/old-chef2
107
33
  spec/hunk_spec.rb
108
34
  spec/issues_spec.rb
109
35
  spec/lcs_spec.rb
@@ -113,3 +39,85 @@ spec/sdiff_spec.rb
113
39
  spec/spec_helper.rb
114
40
  spec/traverse_balanced_spec.rb
115
41
  spec/traverse_sequences_spec.rb
42
+ test/fixtures/123_x
43
+ test/fixtures/456_x
44
+ test/fixtures/aX
45
+ test/fixtures/bXaX
46
+ test/fixtures/ds1.csv
47
+ test/fixtures/ds2.csv
48
+ test/fixtures/empty
49
+ test/fixtures/file1.bin
50
+ test/fixtures/file2.bin
51
+ test/fixtures/four_lines
52
+ test/fixtures/four_lines_with_missing_new_line
53
+ test/fixtures/ldiff/diff.missing_new_line1-e
54
+ test/fixtures/ldiff/diff.missing_new_line1-f
55
+ test/fixtures/ldiff/diff.missing_new_line2-e
56
+ test/fixtures/ldiff/diff.missing_new_line2-f
57
+ test/fixtures/ldiff/error.diff.chef-e
58
+ test/fixtures/ldiff/error.diff.chef-f
59
+ test/fixtures/ldiff/error.diff.missing_new_line1-e
60
+ test/fixtures/ldiff/error.diff.missing_new_line1-f
61
+ test/fixtures/ldiff/error.diff.missing_new_line2-e
62
+ test/fixtures/ldiff/error.diff.missing_new_line2-f
63
+ test/fixtures/ldiff/output.diff
64
+ test/fixtures/ldiff/output.diff-c
65
+ test/fixtures/ldiff/output.diff-u
66
+ test/fixtures/ldiff/output.diff.bin1
67
+ test/fixtures/ldiff/output.diff.bin1-c
68
+ test/fixtures/ldiff/output.diff.bin1-e
69
+ test/fixtures/ldiff/output.diff.bin1-f
70
+ test/fixtures/ldiff/output.diff.bin1-u
71
+ test/fixtures/ldiff/output.diff.bin2
72
+ test/fixtures/ldiff/output.diff.bin2-c
73
+ test/fixtures/ldiff/output.diff.bin2-e
74
+ test/fixtures/ldiff/output.diff.bin2-f
75
+ test/fixtures/ldiff/output.diff.bin2-u
76
+ test/fixtures/ldiff/output.diff.chef
77
+ test/fixtures/ldiff/output.diff.chef-c
78
+ test/fixtures/ldiff/output.diff.chef-u
79
+ test/fixtures/ldiff/output.diff.chef2
80
+ test/fixtures/ldiff/output.diff.chef2-c
81
+ test/fixtures/ldiff/output.diff.chef2-d
82
+ test/fixtures/ldiff/output.diff.chef2-u
83
+ test/fixtures/ldiff/output.diff.empty.vs.four_lines
84
+ test/fixtures/ldiff/output.diff.empty.vs.four_lines-c
85
+ test/fixtures/ldiff/output.diff.empty.vs.four_lines-e
86
+ test/fixtures/ldiff/output.diff.empty.vs.four_lines-f
87
+ test/fixtures/ldiff/output.diff.empty.vs.four_lines-u
88
+ test/fixtures/ldiff/output.diff.four_lines.vs.empty
89
+ test/fixtures/ldiff/output.diff.four_lines.vs.empty-c
90
+ test/fixtures/ldiff/output.diff.four_lines.vs.empty-e
91
+ test/fixtures/ldiff/output.diff.four_lines.vs.empty-f
92
+ test/fixtures/ldiff/output.diff.four_lines.vs.empty-u
93
+ test/fixtures/ldiff/output.diff.issue95_trailing_context
94
+ test/fixtures/ldiff/output.diff.issue95_trailing_context-c
95
+ test/fixtures/ldiff/output.diff.issue95_trailing_context-e
96
+ test/fixtures/ldiff/output.diff.issue95_trailing_context-f
97
+ test/fixtures/ldiff/output.diff.issue95_trailing_context-u
98
+ test/fixtures/ldiff/output.diff.missing_new_line1
99
+ test/fixtures/ldiff/output.diff.missing_new_line1-c
100
+ test/fixtures/ldiff/output.diff.missing_new_line1-e
101
+ test/fixtures/ldiff/output.diff.missing_new_line1-f
102
+ test/fixtures/ldiff/output.diff.missing_new_line1-u
103
+ test/fixtures/ldiff/output.diff.missing_new_line2
104
+ test/fixtures/ldiff/output.diff.missing_new_line2-c
105
+ test/fixtures/ldiff/output.diff.missing_new_line2-e
106
+ test/fixtures/ldiff/output.diff.missing_new_line2-f
107
+ test/fixtures/ldiff/output.diff.missing_new_line2-u
108
+ test/fixtures/new-chef
109
+ test/fixtures/new-chef2
110
+ test/fixtures/old-chef
111
+ test/fixtures/old-chef2
112
+ test/test_block.rb
113
+ test/test_change.rb
114
+ test/test_diff.rb
115
+ test/test_helper.rb
116
+ test/test_hunk.rb
117
+ test/test_issues.rb
118
+ test/test_lcs.rb
119
+ test/test_ldiff.rb
120
+ test/test_patch.rb
121
+ test/test_sdiff.rb
122
+ test/test_traverse_balanced.rb
123
+ test/test_traverse_sequences.rb
data/README.md CHANGED
@@ -1,14 +1,12 @@
1
1
  # Diff::LCS
2
2
 
3
- - home :: https://github.com/halostatue/diff-lcs
4
- - changelog :: https://github.com/halostatue/diff-lcs/blob/main/CHANGELOG.md
5
- - code :: https://github.com/halostatue/diff-lcs
6
- - bugs :: https://github.com/halostatue/diff-lcs/issues
7
- - rdoc :: http://rubydoc.info/github/halostatue/diff-lcs
3
+ [![RubyGems Version][shield-gems]][rubygems] ![Coveralls][shield-coveralls]
4
+ [![Build Status][shield-ci]][ci-workflow]
8
5
 
9
- <a href="https://github.com/halostatue/diff-lcs/actions">
10
- <img src="https://github.com/halostatue/diff-lcs/workflows/CI/badge.svg" />
11
- </a>
6
+ - code :: <https://github.com/halostatue/diff-lcs>
7
+ - issues :: <https://github.com/halostatue/diff-lcs/issues>
8
+ - docs :: <https://halostatue.github.io/diff-lcs/>
9
+ - changelog :: <https://github.com/halostatue/diff-lcs/blob/main/CHANGELOG.md>
12
10
 
13
11
  ## Description
14
12
 
@@ -88,5 +86,11 @@ Subsequences</em>, CACM, vol.20, no.5, pp.350-353, May 1977, with a few minor
88
86
  improvements to improve the speed. A simplified description of the algorithm,
89
87
  originally written for the Perl version, was written by Mark-Jason Dominus.
90
88
 
89
+ [ci-workflow]: https://github.com/halostatue/diff-lcs/actions/workflows/ci.yml
90
+ [coveralls]: https://coveralls.io/github/halostatue/diff-lcs?branch=main
91
+ [perl]: https://search.cpan.org/~nedkonz/Algorithm-Diff-1.15/
92
+ [rubygems]: https://rubygems.org/gems/diff-lcs
93
+ [shield-ci]: https://img.shields.io/github/actions/workflow/status/halostatue/diff-lcs/ci.yml?style=for-the-badge "Build Status"
94
+ [shield-coveralls]: https://img.shields.io/coverallsCoverage/github/halostatue/diff-lcs?style=for-the-badge
95
+ [shield-gems]: https://img.shields.io/gem/v/diff-lcs?style=for-the-badge "Version"
91
96
  [smalltalk]: ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st
92
- [perl]: http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15/