]> git.ipfire.org Git - thirdparty/git.git/commit - grep.c
grep/icase: avoid kwsset on literal non-ascii strings
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sat, 25 Jun 2016 05:22:30 +0000 (07:22 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Jun 2016 14:31:35 +0000 (07:31 -0700)
commit5c1ebcca4d1df3b2a84d01b3f32ec13bf8f760f8
treeb3ae3c96fcc407dad3de84c7c4d29ca2447bc426
parentd8acfe1eaf8621025c4095d3fbb88b2703b3fa54
grep/icase: avoid kwsset on literal non-ascii strings

When we detect the pattern is just a literal string, we avoid heavy
regex engine and use fast substring search implemented in kwsset.c.
But kws uses git-ctype which is locale-independent so it does not know
how to fold case properly outside ascii range. Let regcomp or pcre
take care of this case instead. Slower, but accurate.

Noticed-by: Plamen Totev <plamen.totev@abv.bg>
Helped-by: René Scharfe <l.s.r@web.de>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
grep.c
t/t7812-grep-icase-non-ascii.sh [new file with mode: 0755]