aboutsummaryrefslogtreecommitdiff
path: root/quote.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-06-25 07:22:31 +0200
committerJunio C Hamano <gitster@pobox.com>2016-07-01 12:44:30 -0700
commit793dc676e08394ed15bffe0ed66606ff9ced1c6a (patch)
tree8176b0281abf2fb31e70be8439ad4a3ec4fe56de /quote.h
parent5c1ebcca4d1df3b2a84d01b3f32ec13bf8f760f8 (diff)
downloadgit-793dc676e08394ed15bffe0ed66606ff9ced1c6a.tar.gz
git-793dc676e08394ed15bffe0ed66606ff9ced1c6a.tar.xz
grep/icase: avoid kwsset when -F is specified
Similar to the previous commit, we can't use kws on icase search outside ascii range. But we can't simply pass the pattern to regcomp/pcre like the previous commit because it may contain regex special characters, so we need to quote the regex first. To avoid misquote traps that could lead to undefined behavior, we always stick to basic regex engine in this case. We don't need fancy features for grepping a literal string anyway. basic_regex_quote_buf() assumes that if the pattern is in a multibyte encoding, ascii chars must be unambiguously encoded as single bytes. This is true at least for UTF-8. For others, let's wait until people yell up. Chances are nobody uses multibyte, non utf-8 charsets anymore. 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>
Diffstat (limited to 'quote.h')
-rw-r--r--quote.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/quote.h b/quote.h
index 99e04d34b..362d315be 100644
--- a/quote.h
+++ b/quote.h
@@ -67,5 +67,6 @@ extern char *quote_path_relative(const char *in, const char *prefix,
extern void perl_quote_buf(struct strbuf *sb, const char *src);
extern void python_quote_buf(struct strbuf *sb, const char *src);
extern void tcl_quote_buf(struct strbuf *sb, const char *src);
+extern void basic_regex_quote_buf(struct strbuf *sb, const char *src);
#endif