From ea8c4b85a481a30478506b40f0388424a3341f7d Mon Sep 17 00:00:00 2001 From: nmlgc Date: Sun, 16 Apr 2023 19:36:42 +0200 Subject: [PATCH] [Hooks] pre-commit: Preserve CRLF line endings Part of P0239, funded by Ember2528. --- hooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/pre-commit b/hooks/pre-commit index d39327ba..4baa6cf3 100644 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -11,7 +11,7 @@ fi # Remove trailing commas from `public` directives. These crash on TASM32 # version 5.0, but work on later versions. for f in `git diff-index --name-only --cached --diff-filter=ACMRX ${against} | grep \.asm$ -i`; do - if [ -n "$(sed -i -E 's/(public\s+[^;]+?),\s*(;.*)?$/\1\2/w /dev/stdout' "$f")" ]; then + if [ -n "$(sed -b -i -E 's/(public\s+[^;]+?),\s*(;.*)?$/\1\2/w /dev/stdout' "$f")" ]; then echo "$f"': removed a trailing comma from a `public` line, please re-stage.' exit 1 fi