diff --git a/btest-diff b/btest-diff index 93699fb..bf0178c 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"