1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-13 15:26:26 +02:00

chainlint: add test of pathological case which triggered false positive

This extract from contrib/subtree/t7900 triggered a false positive due
to three chainlint limitations:

* recognizing only a "blessed" set of here-doc tag names in a subshell
  ("EOF", "EOT", "INPUT_END"), of which "TXT" is not a member

* inability to recognize multi-line $(...) when the first statement of
  the body is cuddled with the opening "$("

* inability to recognize multiple constructs on a single line, such as
  opening a multi-line $(...) and starting a here-doc

Now that all of these shortcomings have been addressed, turn this rather
pathological bit of shell coding into a chainlint test case.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Eric Sunshine 2018-08-13 04:47:39 -04:00 committed by Junio C Hamano
parent 22e3e0241a
commit 4f69176feb
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,10 @@
(
chks="sub1sub2sub3sub4" &&
chks_sub=$(cat | sed 's,^,sub dir/,'
>>) &&
chkms="main-sub1main-sub2main-sub3main-sub4" &&
chkms_sub=$(cat | sed 's,^,sub dir/,'
>>) &&
subfiles=$(git ls-files) &&
check_equal "$subfiles" "$chkms$chks"
>)

View File

@ -0,0 +1,22 @@
(
chks="sub1
sub2
sub3
sub4" &&
chks_sub=$(cat <<TXT | sed 's,^,sub dir/,'
$chks
TXT
) &&
chkms="main-sub1
main-sub2
main-sub3
main-sub4" &&
chkms_sub=$(cat <<TXT | sed 's,^,sub dir/,'
$chkms
TXT
) &&
subfiles=$(git ls-files) &&
check_equal "$subfiles" "$chkms
$chks"
)