diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-03-07 12:12:59 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-03-07 12:12:59 -0800 |
commit | 1e4d0875acbce3c881bc1de66c8900cdc240ebe8 (patch) | |
tree | 1f8ebc2181351b54d600b16a1ec1434e51049352 /diffcore-pickaxe.c | |
parent | Merge branch 'jh/threadable-symlink-check' (diff) | |
parent | ctype.c: Fix a sparse warning (diff) | |
download | tgif-1e4d0875acbce3c881bc1de66c8900cdc240ebe8.tar.xz |
Merge branch 'jc/pickaxe-ignore-case'
By Junio C Hamano (2) and Ramsay Jones (1)
* jc/pickaxe-ignore-case:
ctype.c: Fix a sparse warning
pickaxe: allow -i to search in patch case-insensitively
grep: use static trans-case table
Diffstat (limited to 'diffcore-pickaxe.c')
-rw-r--r-- | diffcore-pickaxe.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c index 380a837b5b..ed23eb4bdd 100644 --- a/diffcore-pickaxe.c +++ b/diffcore-pickaxe.c @@ -138,8 +138,12 @@ static void diffcore_pickaxe_grep(struct diff_options *o) { int err; regex_t regex; + int cflags = REG_EXTENDED | REG_NEWLINE; - err = regcomp(®ex, o->pickaxe, REG_EXTENDED | REG_NEWLINE); + if (DIFF_OPT_TST(o, PICKAXE_IGNORE_CASE)) + cflags |= REG_ICASE; + + err = regcomp(®ex, o->pickaxe, cflags); if (err) { char errbuf[1024]; regerror(err, ®ex, errbuf, 1024); @@ -237,7 +241,8 @@ static void diffcore_pickaxe_count(struct diff_options *o) } regexp = ®ex; } else { - kws = kwsalloc(NULL); + kws = kwsalloc(DIFF_OPT_TST(o, PICKAXE_IGNORE_CASE) + ? tolower_trans_tbl : NULL); kwsincr(kws, needle, len); kwsprep(kws); } |