Thread (4 messages) 4 messages, 4 authors, 2022-09-08

Re: [PATCH] tests: replace mingw_test_cmp with a helper in C

From: Junio C Hamano <hidden>
Date: 2022-09-07 16:25:49

Possibly related (same subject, not in this thread)

René Scharfe [off-list ref] 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 ;-)
quoted
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help