diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2018-08-29 05:45:32 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-29 10:57:38 -0700 |
commit | 3042b6bb59787613e36e459bf60994a26bb5a5df (patch) | |
tree | 33e4e502498f304e2cc861dd37d22c3970d9f668 /t/chainlint.sed | |
parent | chainlint: add test of pathological case which triggered false positive (diff) | |
download | tgif-3042b6bb59787613e36e459bf60994a26bb5a5df.tar.xz |
chainlint: match "quoted" here-doc tags
A here-doc tag can be quoted ('EOF'/"EOF") or escaped (\EOF) to suppress
interpolation within the body. chainlint recognizes single-quoted and
escaped tags, but does not know about double-quoted tags. For
completeness, teach it to recognize double-quoted tags, as well.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/chainlint.sed')
-rw-r--r-- | t/chainlint.sed | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/t/chainlint.sed b/t/chainlint.sed index 8544df38df..1da58b554b 100644 --- a/t/chainlint.sed +++ b/t/chainlint.sed @@ -94,8 +94,8 @@ # here-doc -- swallow it to avoid false hits within its body (but keep the # command to which it was attached) -/<<[ ]*[-\\']*[A-Za-z0-9_]/ { - s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<</ +/<<[ ]*[-\\'"]*[A-Za-z0-9_]/ { + s/^\(.*\)<<[ ]*[-\\'"]*\([A-Za-z0-9_][A-Za-z0-9_]*\)['"]*/<\2>\1<</ s/[ ]*<<// :hereslurp N @@ -159,7 +159,7 @@ s/.*\n// } :folded # here-doc -- swallow it -/<<[ ]*[-\\']*[A-Za-z0-9_]/bheredoc +/<<[ ]*[-\\'"]*[A-Za-z0-9_]/bheredoc # comment or empty line -- discard since final non-comment, non-empty line # before closing ")", "done", "elsif", "else", or "fi" will need to be # re-visited to drop "suspect" marking since final line of those constructs @@ -281,7 +281,7 @@ bfolded # found here-doc -- swallow it to avoid false hits within its body (but keep # the command to which it was attached) :heredoc -s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<</ +s/^\(.*\)<<[ ]*[-\\'"]*\([A-Za-z0-9_][A-Za-z0-9_]*\)['"]*/<\2>\1<</ s/[ ]*<<// :hereslurpsub N |