• 
      

    Add support for Apple Diff.

    Review Request #12647 — Created Sept. 26, 2022 and submitted

    Information

    RBTools
    release-4.x

    Reviewers

    Starting in macOS Ventura, the diff command 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
    for output.

    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
    (by setting 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
    Diff behavior.

    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
    be compatible.

    All unit tests pass on a system with GNU Diff and on one with
    Apple Diff.

    Summary ID
    Add support for Apple Diff.
    Starting in macOS Ventura, the `diff` command will be Apple Diff instead of GNU Diff. This is basd 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 for output. 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 (by setting `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 Diff behavior. 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 be compatible.
    68248330ddc6c9687f607d094bd7ec1b977394de
    Description From Last Updated

    Typo in the description: basd -> based

    maubinmaubin

    'os' imported but unused Column: 1 Error code: F401

    reviewbotreviewbot

    'platform' imported but unused Column: 1 Error code: F401

    reviewbotreviewbot
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    chipx86
    maubin
    1. 
        
    2. Show all issues

      Typo in the description: basd -> based

    3. 
        
    chipx86
    maubin
    1. Ship It!
    2. 
        
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-4.x (1c35d7b)