This thread contains a patchset. You're looking at the original emails,
but you may wish to use the patch review UI.
Review patch
2
2
[PATCH sxmo-utils] sxmo_migrate.sh: fixed fallback color diff
It worked with GNU sed but not with busybox sed.
This current version works with both.
---
scripts/core/sxmo_migrate.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/core/sxmo_migrate.sh b/scripts/core/sxmo_migrate.sh
index 32a9b03..fc722d6 100755
--- a/scripts/core/sxmo_migrate.sh
+++ b/scripts/core/sxmo_migrate.sh
@@ -34,8 +34,9 @@ smartdiff() {
colordiff -ud "$@"
else
# poor man's ad-hoc colordiff
- # shellcheck disable=SC2086
- diff -ud "$@" | sed -E -e 's/^-(.*)$/-\x1b[31m\1\x1b[0m/' -e 's/^\+(.*)$/+\x1b[32m\1\x1b[0m/' -e 's/^@@(.*)$/\x1b[34m@@\1\x1b[0m/'
+ ESC=$(printf "\e")
+ # shellcheck disable=SC1087
+ diff -ud "$@" | sed -E -e "s/^-(.*)$/-$ESC[31m\1$ESC[0m/" -e "s/^\+(.*)$/+$ESC[32m\1$ESC[0m/" -e "s/^@@(.*)$/$ESC[34m@@\1$ESC[0m/"
fi
}
--
2.47.1
[sxmo-utils/patches/test.yml] build success
Applied (for 1.17.1 release)