Version 0.2.0 behavior is documented here. Thesupport record separates local verification frompublished MoonX behavior; moonx examples use registry releases.
Unified (---/+++/@@) and traditional context (***/---/********)patches are parsed before writes. Hunks first search for all context at thedeclared position plus the previous successful offset. Other candidates aretried by increasing distance, with a later candidate winning an equal-distancetie. If no exact-context candidate matches, fuzz removes outer context insuccessive tiers; -F/--fuzz=N sets the maximum (default 2, -F0 keeps allcontext). Unequal leading/trailing context retains GNU's start/end anchoring.Ignored context is copied from the actual input, preserving its bytes. -Rreverses additions and removals. -pN strips leading path components, -dchanges the base directory, -i selects the patch input, and -o - emits theresults to stdout in file-patch order. An explicit ORIGINALFILE still requiresa single-file patch. With -o -, progress and hunk diagnostics go to stderr.--dry-run performs the same checks without creating targets, rejects ortemporary files; an explicit -o - still emits the checked result.-s suppresses routine progress and individual hunk messages, but retains thefailed-hunk summary.-u/-c require unified/context input. -t/--batch checks the first hunk inboth directions at each fuzz tier and automatically selects a detected reverse,including a create/delete whose expected existence is reversed. It reports thechoice without reading confirmation from patch stdin. Without -p, only thebasename is retained; unsafe traversal paths after stripping are rejected.--no-backup-if-mismatch is accepted; this profile does not create backups.
Creating a file from /dev/null and deleting a file to /dev/null aresupported when the result is unambiguous. Updating an existing pathname isdeliberately rejected before reading the target: an in-place write couldmodify hard-link aliases, while replacing the inode requires the originalfile mode, which released MoonBit APIs do not expose. Named -o output isalso rejected because upstream copies source permissions to the output.Use --dry-run or -o - for existing files.
A rejected hunk leaves its input region unchanged and does not prevent laterhunks or files from being checked and applied. Successfully applied hunks retaintheir effects in the result. Rejected hunks preserve their unified/contextformat, original header text, section, no-newline markers and order; theirranges account for earlier successful changes. New rejects default to<output>.rej (-.rej with -o -). -r/--reject-file=FILE selects one newreject file shared by the invocation, and -r - discards reject data. Rejectfiles are exclusively created and remain open while appending this invocation'slater rejects. For each file patch, an existing reject destination is refusedbefore that file's target writes; existing rejects are never truncated orfollowed as a replacement workaround.
A partially applied deletion that would rewrite remaining existing contenthas the same mode-preservation boundary as an ordinary existing-file update.An entirely rejected deletion leaves a nonempty target unchanged; deletion ofan already-empty target follows the selected GNU empty-output behavior. A fullysuccessful deletion removes its target. Binary, mode, rename and interactive reversal promptingremain outside this profile. Errors return 2 for a malformed, unsupported orfatal filesystem request, 1 when any hunk is rejected, and 0 when all apply.Inputs and patches are still buffered; offset/fuzz support does not establisha constant-memory claim.--help prints usage and --version prints the command and package version.
Standalone --version prints exactly patch 0.2.0 followed by onenewline. Standalone --help starts with Usage: patch, lists bothmetadata options, and ends with a newline. Both write to stdout, leave stdinunread, and exit with status 0. Exact-version publication and verificationremain recorded separately in the support record.