Re: [PATCH v3 2/2] tests(mingw): avoid very slow `mingw_test_cmp`
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 18, 2022, 23:19 UTC
- Message-ID
- <xmqqr0xzkfz8.fsf@gitster.g>
- In-Reply-To
- <221114.86pmdplbs5.gmgdl@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 12 quoted lines
> IOW this bit in t/README: > > - Don't use '! git cmd' when you want to make sure the git command > exits with failure in a controlled way by calling "die()".[...] > > So, before this series a test like this on Windows, with > GIT_TEST_CMP=mingw_test_cmp: > > ! test_cmp foo bar > > Would only succeed if "foo" and "bar" weren't identical, now it'll also > succeed if 'git diff --no-index' happens to segfault on those inputs.
Well "! test_cmp" is wrong anyway, because it _expects_ two files are the same and gives more detailed diagnosis when they differ by giving "diff" output.
If you expect them to be different, "! test_cmp" would give "detailed diagnosis" in the wrong case, i.e. the outcome is what we expect.
So the caller must do "test_cmp !" whether the underlying implementation of test_cmp uses "diff -u" or "diff --no-index".