t3920: support CR-eating grep
commit86325d36e604e872e189e8dba6d914007918311f
authorRené Scharfe <l.s.r@web.de>
Fri, 2 Dec 2022 16:51:13 +0000 (2 17:51 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 7 Dec 2022 04:33:18 +0000 (7 13:33 +0900)
tree81ad7dd26348ae03b1f4474acc1f74d0894d8539
parent500317ae03f635b247627eeb9760d9de2e343875
t3920: support CR-eating grep

grep(1) converts CRLF line endings to LF on current MinGW:

   $ uname -sr
   MINGW64_NT-10.0-22621 3.3.6-341.x86_64

   $ printf 'a\r\n' | hexdump.exe -C
   00000000  61 0d 0a                                          |a..|
   00000003

   $ printf 'a\r\n' | grep . | hexdump.exe -C
   00000000  61 0a                                             |a.|
   00000002

Create the intended test file by grepping the original file with LF
line endings and adding CRs explicitly.

The missing CRs went unnoticed because test_cmp on MinGW ignores line
endings since 4d715ac05c (Windows: a test_cmp that is agnostic to random
LF <> CRLF conversions, 2013-10-26).  Fix this test anyway to avoid
depending on that special test_cmp behavior, especially since this is
the only test that needs it.

Piping the output of grep(1) through append_cr has the side-effect of
ignoring its return value.  That means we no longer need the explicit
"|| true" to support commit messages without a body.

Signed-off-by: René Scharfe <l.s.r@web.de>
Acked-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3920-crlf-messages.sh