Subject: Re: js/drop-mingw-test-cmp, was Re: What's cooking in git.git (Dec 2022, #03; Sun, 11)

From: Junio C Hamano <[email-masked]>
Date: Wed, 21 Dec 2022 22:05:59 +0900

Johannes Schindelin <[email-masked]> writes:

>> IIRC the review comments hinted that MinGW specific test_cmp that
>> equates CRLF and LF are no longer needed,
>
> That does not match my understanding. The MSYS2 tools we use in Git for
> Windows' SDK (and therefore, in the `win` jobs of our CI runs) are outside
> of our control, and have been known to change behavior with regards to
> line endings.

We may have been following two different threads, I suspect?

The behaviour of the platform tools may unexpectedly change without
any good reason, and you may not be able to file a bug report when
that happens.  One way to allow our tests pass in such an
environment is to make them sloppy to accomodate the potential
variation in their behaviour.  That is what the "ignore line ending"
comparison gives us.

But it means tests in MinGW environment would not notice if the
output _we_ produce from Git has unintentional changes, no?
Imagine we break the checkout codepath to write LF working tree
files when we should write CRLF, or vice versa.  A lenient test_cmp
under discussion (whether the one in the current codebase, or the
one that the patch wants to update) would not care.

I know we have been operating under such a test environment, but
after seeing the exchange between Réne and J6t, I was hoping that we
do not have to keep being sloppy.  After all, noticing unintended
behaviour changes in our code is the whole point of running tests.

Getting rid of the "ignore line ending" comparison would mean that,
while we would be able to catch _our_ bugs, we would also notice and
have to deal with unintended behaviour changes in MSYS2 tools.  But
how bad would it be?  I doubt that it would be like you update from
upstream every other week, and every other such update flips the
line endings---that would make you scramble, filing bug reports to
MSYS2 and temporarily patching our tests to be sloppier, once every
month, that may be a bit too often.