]> git.ipfire.org Git - thirdparty/git.git/commit
tests: adjust whitespace in chainlint expectations
authorPatrick Steinhardt <ps@pks.im>
Fri, 15 Dec 2023 06:42:47 +0000 (07:42 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 15 Dec 2023 16:36:14 +0000 (08:36 -0800)
commit647b5e09987ac74e158d66ac2fd0036f2c9c99fe
treeffd07bed910f0206a2219ed0e9f0a835d8a5a991
parentfb7d80edcae482f4fa5d4be0227dc3054734e5f3
tests: adjust whitespace in chainlint expectations

The "check-chainlint" target runs automatically when running tests and
performs self-checks to verify that the chainlinter itself produces the
expected output. Originally, the chainlinter was implemented via sed,
but the infrastructure has been rewritten in fb41727b7e (t: retire
unused chainlint.sed, 2022-09-01) to use a Perl script instead.

The rewrite caused some slight whitespace changes in the output that are
ultimately not of much importance. In order to be able to assert that
the actual chainlinter errors match our expectations we thus have to
ignore whitespace characters when diffing them. As the `-w` flag is not
in POSIX we try to use `git diff -w --no-index` before we fall back to
`diff -w -u`.

To accomodate for cases where the host system has no Git installation we
use the locally-compiled version of Git. This can result in problems
though when the Git project's repository is using extensions that the
locally-compiled version of Git doesn't understand. It will refuse to
run and thus cause the checks to fail.

Instead of improving the detection logic, fix our ".expect" files so
that we do not need any post-processing at all anymore. This allows us
to drop the `-w` flag when diffing so that we can always use diff(1)
now.

Note that we keep some of the post-processing of `chainlint.pl` output
intact to strip leading line numbers generated by the script. Having
these would cause a rippling effect whenever we add a new test that
sorts into the middle of existing tests and would require us to
renumerate all subsequent lines, which seems rather pointless.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
27 files changed:
t/Makefile
t/chainlint/blank-line-before-esac.expect
t/chainlint/blank-line.expect
t/chainlint/block.expect
t/chainlint/chain-break-background.expect
t/chainlint/chain-break-return-exit.expect
t/chainlint/chain-break-status.expect
t/chainlint/chained-subshell.expect
t/chainlint/command-substitution-subsubshell.expect
t/chainlint/dqstring-line-splice.expect
t/chainlint/dqstring-no-interpolate.expect
t/chainlint/empty-here-doc.expect
t/chainlint/exclamation.expect
t/chainlint/for-loop-abbreviated.expect
t/chainlint/for-loop.expect
t/chainlint/function.expect
t/chainlint/here-doc.expect
t/chainlint/loop-detect-status.expect
t/chainlint/nested-cuddled-subshell.expect
t/chainlint/nested-loop-detect-failure.expect
t/chainlint/nested-subshell.expect
t/chainlint/pipe.expect
t/chainlint/subshell-here-doc.expect
t/chainlint/subshell-one-liner.expect
t/chainlint/t7900-subtree.expect
t/chainlint/token-pasting.expect
t/chainlint/while-loop.expect