git-subline-merge
git-subline-merge copied to clipboard
Diff coloring does not work on macOS 13 Ventura
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.
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.
Similar issue: https://github.com/NixOS/nix/issues/7286
I've pushed a commit (56d503a098f619476d03d29bf67514e6023433ab) 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.
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 9193600179c0902378d5c90b68fdffd232ef53df.