grep: add tests to fix blind spots with \0 patterns
commit966be95549374916fc2736897b99c4918899b8ca
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sat, 20 May 2017 21:42:17 +0000 (20 21:42 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 20 May 2017 23:25:38 +0000 (21 08:25 +0900)
treeb1b209d93dcfb7ad926a65ffb0b805fb1511f0ec
parent12fc32faa8b51d33f3793c45ea20ab02b9717574
grep: add tests to fix blind spots with \0 patterns

Address a big blind spot in the tests for patterns containing \0. The
is_fixed() function considers any string that contains \0 fixed, even
if it contains regular expression metacharacters, those patterns are
currently matched with kwset.

Before this change removing that memchr(s, 0, len) check from
is_fixed() wouldn't change the result of any of the tests, since
regcomp() will happily match the part before the \0.

The kwset path is dependent on whether the the -i flag is on, and
whether the pattern has any non-ASCII characters, but none of this was
tested for.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7008-grep-binary.sh