diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-12-03 13:51:26 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-12-03 13:51:26 -0800 |
commit | f2c0ca4fae299c2515c1554dbeec2080af5c6792 (patch) | |
tree | 5aedb798c52fee287b45bc85e8bf2e726a5289a9 /builtin-grep.c | |
parent | 9a6b9cdd7240d10f9e70bfc383960b28c8f2b9a7 (diff) | |
parent | 5183bf67278ce5a0da9779d74f05169beac219b8 (diff) | |
download | git-f2c0ca4fae299c2515c1554dbeec2080af5c6792.tar.gz |
Merge branch 'bc/grep-i-F' into maint
* bc/grep-i-F:
grep: Allow case insensitive search of fixed-strings
Diffstat (limited to 'builtin-grep.c')
-rw-r--r-- | builtin-grep.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin-grep.c b/builtin-grep.c index 1df25b07b5..d79a6260a4 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -367,7 +367,7 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached) push_arg("-h"); if (opt->regflags & REG_EXTENDED) push_arg("-E"); - if (opt->regflags & REG_ICASE) + if (opt->ignore_case) push_arg("-i"); if (opt->binary == GREP_BINARY_NOMATCH) push_arg("-I"); @@ -706,8 +706,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix) OPT_GROUP(""), OPT_BOOLEAN('v', "invert-match", &opt.invert, "show non-matching lines"), - OPT_BIT('i', "ignore-case", &opt.regflags, - "case insensitive matching", REG_ICASE), + OPT_BOOLEAN('i', "ignore-case", &opt.ignore_case, + "case insensitive matching"), OPT_BOOLEAN('w', "word-regexp", &opt.word_regexp, "match patterns only at word boundaries"), OPT_SET_INT('a', "text", &opt.binary, @@ -830,6 +830,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix) external_grep_allowed = 0; if (!opt.pattern_list) die("no pattern given."); + if (!opt.fixed && opt.ignore_case) + opt.regflags |= REG_ICASE; if ((opt.regflags != REG_NEWLINE) && opt.fixed) die("cannot mix --fixed-strings and regexp"); compile_grep_patterns(&opt); |