Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff coloring does not work on macOS 13 Ventura #19

Open
paulaltin opened this issue Mar 14, 2023 · 4 comments
Open

Diff coloring does not work on macOS 13 Ventura #19

paulaltin opened this issue Mar 14, 2023 · 4 comments

Comments

@paulaltin
Copy link
Owner

Running git-subline-merge in interactive mode on macOS 13 prints this message before each version of a conflicted hunk:

diff: unrecognized option `--old-group-format=D%de+%dn,%dE+%dN<<<<<<<GIT_SUBLINE_MERGE_DELIMITER>>>>>>>'
usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
            [--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
            [-I pattern] [-F pattern] [-L label] file1 file2
       diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]
            [--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
            [-F pattern] -C number file1 file2
       diff [-aBbdiltw] [-I pattern] [--ignore-case] [--no-ignore-case]
            [--normal] [--strip-trailing-cr] [--tabsize] -D string file1 file2
       diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]
            [--no-ignore-case] [--normal] [--tabsize] [--strip-trailing-cr]
            [-F pattern] -U number file1 file2
       diff [-aBbdilNPprsTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
            [--no-ignore-case] [--normal] [--tabsize] [-I pattern] [-L label]
            [-F pattern] [-S name] [-X file] [-x pattern] dir1 dir2
       diff [-aBbditwW] [--expand-tabs] [--ignore-all-blanks]
            [--ignore-blank-lines] [--ignore-case] [--minimal]
            [--no-ignore-file-name-case] [--strip-trailing-cr]
            [--suppress-common-lines] [--tabsize] [--text] [--width]
            -y | --side-by-side file1 file2
       diff [--help] [--version]

The text of the hunk follows, but has no coloring to show which parts were added or removed in each version.

@paulaltin
Copy link
Owner Author

It seems that macOS 13 changed from GNU diff to "Apple diff":

macOS 12:

$ diff --version
diff (GNU diffutils) 2.8.1
Copyright (C) 2002 Free Software Foundation, Inc.

macOS 13:

Apple diff (based on FreeBSD diff)

Apple diff doesn't support the old-group-format, new-group-format, changed-group-format and unchanged-group-format options.

@paulaltin
Copy link
Owner Author

Similar issue: NixOS/nix#7286

@paulaltin
Copy link
Owner Author

paulaltin commented Apr 26, 2023

I've pushed a commit (56d503a) to work around this issue, so the "unrecognized option" error message won't be displayed on macOS any more.

Colored diffs still don't work out of the box on Ventura, and won't unless we can figure out how to do the coloring using BSD-diff (i.e. without the *-group-format options).

#20 has also been resolved, so the README file now explains that Mac users can install GNU diffutils to get colored diffs.

@paulaltin
Copy link
Owner Author

I've pushed a commit (56d503a) to work around this issue, so the "unrecognized option" error message won't be displayed on macOS any more.

The workaround was relying on process substitution and therefore wasn't portable, improved in 9193600.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant