Work in progress. Feedback is welcome!
This project will provide a Zig package for applying diffs in Git and unified formats to directory trees or individual files. It will be free of system dependencies by default while allowing integration with Git or GNU patch when needed.
One use case for this package will be to enable building C and C++ projects from pristine tarballs while applying patches for the host system, bug fixes, or other reasons. This approach is more transparent to dependents compared to building from a forked version of the upstream source.
The package will expose outputs as artifacts (via b.addNamedLazyPath(...))
and accept inputs as options (via b.option(LazyPath, ...)), following the
intended
approach.
Internally, the package will use std.Build.Step.Run instead of custom build
steps in preparation for the separation of the build runner from the configure
process.
By default, the package will use its own patch implementation to help
dependents reduce their system dependencies. Every system dependency removed
makes it easier to onboard new contributors.
However, there will also be options (via b.systemIntegrationOption(...)) to
use the system packages Git or
GNU patch when appropriate, such as when packaging or when build times or
compatibility are of concern.
- Complete implementation and review resource management:
- Ensure a small number of file descriptors are open at any time.
- Delete temporary directories on exit.
- Clean up output directories in case of errors.
- Create a test build step.
- Add additional test cases to check the following behaviors:
- Correct handling of quote wrapped paths.
- Correct handling of patches with junk text between a hunk and the next header.
- Rejection of invalid paths (both wrapped and unwrapped).
- Rejection of empty patches.
- Rejection of patches without any headers.
- Rejection of invalid headers.
- Rejection of invalid hunks.
- Rejection of multiple changes to the same file within a single Git patch.
- Fix bugs.
- Implement the remaining characteristics described in the Rationale.
- Update this README.
- Tag a release.
Uses Zig 0.14.0-dev.3462+edabcf619.