Add support for Apple Diff.
Review Request #12647 — Created Sept. 26, 2022 and submitted
Starting in macOS Ventura, the
diffcommand will be Apple Diff instead
of GNU Diff. This is based on BSD Diff with some GNU Diff
compatibility in the form of function arguments and general Unified Diff
output, but with minor differences in output.
This change implements the Apple Diff backend. It is very similar to the
GNU Diff backend, but without any instructions if missing (as Apple Diff
isn't something you'd install separately), and with some normalization
Normalization ensures that the timestamps are the same between Apple
Diff and GNU Diff. In GNU Diff, file timestamps have millisecond
precision and show the timezone offset. Apple Diff lacks both. This is
documented in the man page, and they state that running in legacy mode
COMMAND_MODE=legacy) will restore milliseconds and
timezone offsets. Rather than trust that legacy mode will exist
long-term, we handle normalization through our own process,
future-proofing to avoid problems if that behavior reverts back to GNU
They do note that millisecond precision and timezone offsets may cause
patches to fail to apply, but that doesn't appear to happen locally and
that would be a wider compatibility problem in the diff world anyway,
requiring normalization on the other end.
All clients that require an external diff tool have been updated to work
with Apple Diff. A notable client is TFS, which may generate a diff by
going directly through GNU Diff by way of
rb-tfs, but it should still
All unit tests pass on a system with GNU Diff and on one with
Removed unused imports.
Revision 2 (+1214 -32)
Checks run (2 succeeded)