Skip to content
  • Ævar Arnfjörð Bjarmason's avatar
    grep: add tests to fix blind spots with \0 patterns · 966be955
    Ævar Arnfjörð Bjarmason authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    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: default avatarÆvar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    966be955