commits
* Use a rope of string array instead of a list of strings
This improves my usecase (a single file diffed with 2000 hunks by a factor of 20
* avoid physical equality, avoid polymorphic equality
* add test case "many-hunks" (from external)
---------
Co-authored-by: Kate <kit-ty-kate@exn.st>
Fix the opam-repository test script
- pushd/popd are not part of sh (at least on FreeBSD) -- now using bash
- with grep */*/opam, I get argument list too long -- now using a recursive grep
GitHub action: test on 4.08, 4.14, and 5.4 - linux only
* Add an `opatch` package and command-line tool
This patch reuses a lot of code written by Kate Deplaix for opam
Co-Authored-By: Kate <kit-ty-kate@exn.st>
Allow to use Patch.patch and Patch.pp_hunk on large diffs with OCaml 4
This also allows to use Patch.patch on large diffs when using OCaml 4
as (@)/List.append is not tail-recursive with OCaml 4
List.map and (@) were not tail-recursive so it would stack overflow
Fix Patch.diff generating malformed patch when adding a line at the end of a file that doesn't end with a newline character
Add support for empty files through git extensions
The POSIX unified diff format does not support them (empty file = absent file)
but the git extensions "deleted file mode" and "new file mode" do.
This also adds support for deleting files without have to knew their
content.
Adding support for these extensions requires specialised variants
to be able to print both the "[deleted|new] file mode <filename>" line
and the "git --diff ..." header line.
Here the diff is between 2025-01-before-archiving-phase1 and 999bff3ed88d26f76ff7eaddbfa7af49ed4737dc from opam-repository
Parse and apply all the unified patch files from opam-repository
See https://github.com/ocaml/ocaml/commit/b710ec0a85f92dc10d5260fbb90a47777db04aee
This follows the GNU patch behaviour, but we're loosing support
for filenames containing spaces when parsing busybox diffs.
Examples of this behaviour can be seen in fix_404.patch from bitstring.2.0.4
and unsafe_string.patch from ordma.0.0.5
Examples of this behaviour can be seen in config.patch from afl-persistent.1.4
Examples of this behaviour can be seen in easy-format-make.diff from easy-format.1.0.1
Examples of this behaviour can be seen in configure.diff from stone.0.1
The POSIX unified diff format does not support them (empty file = absent file)
but the git extensions "deleted file mode" and "new file mode" do.
This also adds support for deleting files without have to knew their
content.
Adding support for these extensions requires specialised variants
to be able to print both the "[deleted|new] file mode <filename>" line
and the "git --diff ..." header line.