From fa5f2e0ccced9168132cdffc33bc6fd013ff28bf Mon Sep 17 00:00:00 2001 From: Maor Hamami Date: Wed, 4 Mar 2026 19:09:36 +0200 Subject: [PATCH] [windows] remove \r before comparison to avoid clrf diff --- btest-diff | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/btest-diff b/btest-diff index 93699fbf..bf0178cd 100755 --- a/btest-diff +++ b/btest-diff @@ -222,10 +222,14 @@ if [ -n "$baseline" ]; then if [ $error -eq 0 ]; then echo "== Diff ===============================" >>"$TEST_DIAGNOSTICS" + # We'd use --strip-trailing-cr in the following, but it's not guaranteed. + # We strip \r in both modes because on Windows, git may check out + # baseline files with CRLF line endings even when marked -text. if is_binary_mode; then - diff -s "$@" "$canon_baseline" "$canon_output" >>"$TEST_DIAGNOSTICS" + diff -s "$@" \ + <(sed 's/\r$//' "$canon_baseline") \ + <(sed 's/\r$//' "$canon_output") >>"$TEST_DIAGNOSTICS" else - # We'd use --strip-trailing-cr in the following, but it's not guaranteed. diff -au "$@" \ <(sed 's/\r$//' "$canon_baseline") \ <(sed 's/\r$//' "$canon_output") >>"$TEST_DIAGNOSTICS"