git/t/chainlint
Patrick Steinhardt 647b5e0998 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>
2023-12-15 08:36:14 -08:00
..
arithmetic-expansion.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
arithmetic-expansion.test
bash-array.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
bash-array.test
blank-line-before-esac.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
blank-line-before-esac.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
blank-line.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
blank-line.test t/chainlint/*.test: generalize self-test commentary 2021-12-13 14:15:28 -08:00
block-comment.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
block-comment.test chainlint.sed: swallow comments consistently 2021-12-13 14:15:29 -08:00
block.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
block.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
broken-chain.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
broken-chain.test
case-comment.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
case-comment.test chainlint.sed: swallow comments consistently 2021-12-13 14:15:29 -08:00
case.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
case.test
chain-break-background.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
chain-break-background.test chainlint.pl: don't require `&` background command to end with `&&` 2022-09-01 10:07:40 -07:00
chain-break-continue.expect chainlint.pl: don't require `return|exit|continue` to end with `&&` 2022-09-01 10:07:40 -07:00
chain-break-continue.test chainlint.pl: don't require `return|exit|continue` to end with `&&` 2022-09-01 10:07:40 -07:00
chain-break-false.expect chainlint.pl: don't flag broken &&-chain if failure indicated explicitly 2022-09-01 10:07:41 -07:00
chain-break-false.test chainlint.pl: don't flag broken &&-chain if failure indicated explicitly 2022-09-01 10:07:41 -07:00
chain-break-return-exit.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
chain-break-return-exit.test chainlint.pl: don't flag broken &&-chain if failure indicated explicitly 2022-09-01 10:07:41 -07:00
chain-break-status.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
chain-break-status.test chainlint.pl: don't flag broken &&-chain if `$?` handled explicitly 2022-09-01 10:07:41 -07:00
chained-block.expect t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
chained-block.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
chained-subshell.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
chained-subshell.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
close-nested-and-parent-together.expect chainlint.sed: stop splitting "(..." into separate lines "(" and "..." 2021-12-13 14:15:29 -08:00
close-nested-and-parent-together.test
close-subshell.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
close-subshell.test
command-substitution-subsubshell.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
command-substitution-subsubshell.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
command-substitution.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
command-substitution.test
comment.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
comment.test
complex-if-in-cuddled-loop.expect chainlint.pl: complain about loops lacking explicit failure handling 2022-09-01 10:07:41 -07:00
complex-if-in-cuddled-loop.test
cuddled-if-then-else.expect chainlint.sed: stop splitting "(..." into separate lines "(" and "..." 2021-12-13 14:15:29 -08:00
cuddled-if-then-else.test
cuddled-loop.expect chainlint.sed: stop splitting "(..." into separate lines "(" and "..." 2021-12-13 14:15:29 -08:00
cuddled-loop.test
cuddled.expect chainlint.sed: stop splitting "(..." into separate lines "(" and "..." 2021-12-13 14:15:29 -08:00
cuddled.test t/chainlint/*.test: generalize self-test commentary 2021-12-13 14:15:28 -08:00
double-here-doc.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
double-here-doc.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
dqstring-line-splice.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
dqstring-line-splice.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
dqstring-no-interpolate.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
dqstring-no-interpolate.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
empty-here-doc.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
empty-here-doc.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
exclamation.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
exclamation.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
exit-loop.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
exit-loop.test
exit-subshell.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
exit-subshell.test
for-loop-abbreviated.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
for-loop-abbreviated.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
for-loop.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
for-loop.test
function.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
function.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
here-doc-close-subshell.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
here-doc-close-subshell.test
here-doc-indent-operator.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
here-doc-indent-operator.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
here-doc-multi-line-command-subst.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
here-doc-multi-line-command-subst.test
here-doc-multi-line-string.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
here-doc-multi-line-string.test
here-doc.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
here-doc.test
if-condition-split.expect t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
if-condition-split.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
if-in-loop.expect chainlint.pl: don't flag broken &&-chain if failure indicated explicitly 2022-09-01 10:07:41 -07:00
if-in-loop.test chainlint.pl: don't flag broken &&-chain if failure indicated explicitly 2022-09-01 10:07:41 -07:00
if-then-else.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
if-then-else.test
incomplete-line.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
incomplete-line.test
inline-comment.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
inline-comment.test
loop-detect-failure.expect chainlint.pl: complain about loops lacking explicit failure handling 2022-09-01 10:07:41 -07:00
loop-detect-failure.test chainlint.pl: complain about loops lacking explicit failure handling 2022-09-01 10:07:41 -07:00
loop-detect-status.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
loop-detect-status.test chainlint.pl: complain about loops lacking explicit failure handling 2022-09-01 10:07:41 -07:00
loop-in-if.expect chainlint.pl: complain about loops lacking explicit failure handling 2022-09-01 10:07:41 -07:00
loop-in-if.test
loop-upstream-pipe.expect chainlint.pl: allow `|| echo` to signal failure upstream of a pipe 2022-09-01 10:07:41 -07:00
loop-upstream-pipe.test chainlint.pl: allow `|| echo` to signal failure upstream of a pipe 2022-09-01 10:07:41 -07:00
multi-line-nested-command-substitution.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
multi-line-nested-command-substitution.test
multi-line-string.expect t/Makefile: apply chainlint.pl to existing self-tests 2022-09-01 10:07:40 -07:00
multi-line-string.test
negated-one-liner.expect chainlint.sed: drop unnecessary distinction between ?!AMP?! and ?!SEMI?! 2021-12-13 14:15:29 -08:00
negated-one-liner.test
nested-cuddled-subshell.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
nested-cuddled-subshell.test
nested-here-doc.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
nested-here-doc.test
nested-loop-detect-failure.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
nested-loop-detect-failure.test chainlint.pl: complain about loops lacking explicit failure handling 2022-09-01 10:07:41 -07:00
nested-subshell-comment.expect chainlint: annotate original test definition rather than token stream 2022-11-08 15:10:49 -05:00
nested-subshell-comment.test
nested-subshell.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
nested-subshell.test t/chainlint/*.test: generalize self-test commentary 2021-12-13 14:15:28 -08:00
not-heredoc.expect chainlint.sed: don't mistake `<< word` in string as here-doc operator 2021-12-13 14:15:29 -08:00
not-heredoc.test chainlint.sed: don't mistake `<< word` in string as here-doc operator 2021-12-13 14:15:29 -08:00
one-liner-for-loop.expect t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
one-liner-for-loop.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
one-liner.expect chainlint.sed: drop unnecessary distinction between ?!AMP?! and ?!SEMI?! 2021-12-13 14:15:29 -08:00
one-liner.test t/chainlint/one-liner: avoid overly intimate chainlint.sed knowledge 2021-12-13 14:15:28 -08:00
p4-filespec.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
p4-filespec.test
pipe.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
pipe.test
return-loop.expect chainlint.pl: don't require `return|exit|continue` to end with `&&` 2022-09-01 10:07:40 -07:00
return-loop.test chainlint.pl: don't require `return|exit|continue` to end with `&&` 2022-09-01 10:07:40 -07:00
semicolon.expect chainlint.pl: complain about loops lacking explicit failure handling 2022-09-01 10:07:41 -07:00
semicolon.test t/chainlint/*.test: generalize self-test commentary 2021-12-13 14:15:28 -08:00
sqstring-in-sqstring.expect t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
sqstring-in-sqstring.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
subshell-here-doc.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
subshell-here-doc.test
subshell-one-liner.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
subshell-one-liner.test
t7900-subtree.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
t7900-subtree.test
token-pasting.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
token-pasting.test t/chainlint: add more chainlint.pl self-tests 2022-09-01 10:07:41 -07:00
unclosed-here-doc-indent.expect tests: diagnose unclosed here-doc in chainlint.pl 2023-03-30 13:07:29 -07:00
unclosed-here-doc-indent.test tests: diagnose unclosed here-doc in chainlint.pl 2023-03-30 13:07:29 -07:00
unclosed-here-doc.expect tests: diagnose unclosed here-doc in chainlint.pl 2023-03-30 13:07:29 -07:00
unclosed-here-doc.test tests: diagnose unclosed here-doc in chainlint.pl 2023-03-30 13:07:29 -07:00
while-loop.expect tests: adjust whitespace in chainlint expectations 2023-12-15 08:36:14 -08:00
while-loop.test