diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2018-08-13 04:47:38 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-13 12:22:12 -0700 |
commit | 22e3e0241ab5add065411d0d8d493f066764465e (patch) | |
tree | c0b2b77d4071eeab6b5c83bc3aff098b7159c64c /builtin/grep.c | |
parent | chainlint: let here-doc and multi-line string commence on same line (diff) | |
download | tgif-22e3e0241ab5add065411d0d8d493f066764465e.tar.xz |
chainlint: recognize multi-line quoted strings more robustly
chainlint.sed recognizes multi-line quoted strings within subshells:
echo "abc
def" >out &&
so it can avoid incorrectly classifying lines internal to the string as
breaking the &&-chain. To identify the first line of a multi-line
string, it checks if the line contains a single quote. However, this is
fragile and can be easily fooled by a line containing multiple strings:
echo "xyz" "abc
def" >out &&
Make detection more robust by checking for an odd number of quotes
rather than only a single one.
(Escaped quotes are not handled, but support may be added later.)
The original multi-line string recognizer rather cavalierly threw away
all but the final quote, whereas the new one is careful to retain all
quotes, so the "expected" output of a couple existing chainlint tests is
updated to account for this new behavior.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/grep.c')
0 files changed, 0 insertions, 0 deletions