Re: [PATCH] tests: replace mingw_test_cmp with a helper in C
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 7, 2022, 16:25 UTC
- Message-ID
- <xmqq7d2fywvr.fsf@gitster.g>
- In-Reply-To
- <b21d2b60-428f-58ec-28b6-3c617b9f2e45@web.de>
René Scharfe <l.s.r@web.de> writes:
> "git diff --no-index - -" also doesn't complain, by the way.
True, but in this case hopefully it is worth to call it out, as both this code that uses "diff --no-index" and "diff --no-index" itself came from the same author ;-)
I think "git diff --no-index - -" should just exit 0 after slurping all its input (i.e. allow it to be placed downstream of a pipe without blocking the upstream), but it is also fine to exit with 0 without reading a single byte from the standard input. Of course the latter is easier to implement ;-)
Show 10 quoted lines
>>> But otherwise the idea is sound. We compare them line by line, >>> using strbuf_getline() to ignore differences in CRLF and LF that >>> originates at 4d715ac0 (Windows: a test_cmp that is agnostic to >>> random LF <> CRLF conversions, 2013-10-26). Only when we find the >>> input different, we use "git diff --no-index" to make the difference >>> (and unfortunately more, as it does not ignore CRLF <> LF >>> differences) visible. > > Why not use "git diff --no-index --ignore-cr-at-eol"? Do you even need > to wrap it?
Hmph. That surely sounds sensible if it works, and I offhand do not see why it shouldn't work.