Merge pull request #7948 from mkenigs/ventura-diff

installer: don't assume GNU diff
This commit is contained in:
Théophane Hufschmitt 2023-05-25 18:15:42 +02:00 committed by GitHub
commit f41dd2c306
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -246,8 +246,15 @@ printf -v _OLD_LINE_FMT "%b" $'\033[1;7;31m-'"$ESC ${RED}%L${ESC}"
printf -v _NEW_LINE_FMT "%b" $'\033[1;7;32m+'"$ESC ${GREEN}%L${ESC}" printf -v _NEW_LINE_FMT "%b" $'\033[1;7;32m+'"$ESC ${GREEN}%L${ESC}"
_diff() { _diff() {
# macOS Ventura doesn't ship with GNU diff. Print similar output except
# without +/- markers or dimming
if diff --version | grep -q "Apple diff"; then
printf -v CHANGED_GROUP_FORMAT "%b" "${GREEN}%>${RED}%<${ESC}"
diff --changed-group-format="$CHANGED_GROUP_FORMAT" "$@"
else
# simple colorized diff comatible w/ pre `--color` versions # simple colorized diff comatible w/ pre `--color` versions
diff --unchanged-group-format="$_UNCHANGED_GRP_FMT" --old-line-format="$_OLD_LINE_FMT" --new-line-format="$_NEW_LINE_FMT" --unchanged-line-format=" %L" "$@" diff --unchanged-group-format="$_UNCHANGED_GRP_FMT" --old-line-format="$_OLD_LINE_FMT" --new-line-format="$_NEW_LINE_FMT" --unchanged-line-format=" %L" "$@"
fi
} }
confirm_rm() { confirm_rm() {