Skip to content

Commit 4f69176

Browse files
sunshinecogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 22e3e02 commit 4f69176

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

t/chainlint/t7900-subtree.expect

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(
2+
chks="sub1sub2sub3sub4" &&
3+
chks_sub=$(cat | sed 's,^,sub dir/,'
4+
>>) &&
5+
chkms="main-sub1main-sub2main-sub3main-sub4" &&
6+
chkms_sub=$(cat | sed 's,^,sub dir/,'
7+
>>) &&
8+
subfiles=$(git ls-files) &&
9+
check_equal "$subfiles" "$chkms$chks"
10+
>)

t/chainlint/t7900-subtree.test

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(
2+
chks="sub1
3+
sub2
4+
sub3
5+
sub4" &&
6+
chks_sub=$(cat <<TXT | sed 's,^,sub dir/,'
7+
$chks
8+
TXT
9+
) &&
10+
chkms="main-sub1
11+
main-sub2
12+
main-sub3
13+
main-sub4" &&
14+
chkms_sub=$(cat <<TXT | sed 's,^,sub dir/,'
15+
$chkms
16+
TXT
17+
) &&
18+
19+
subfiles=$(git ls-files) &&
20+
check_equal "$subfiles" "$chkms
21+
$chks"
22+
)

0 commit comments

Comments
 (0)