pickaxe: honor -i when used with -S and --pickaxe-regex
accccde4 (pickaxe: allow -i to search in patch case-insensitively) allowed case-insenitive matching for -G and -S, but for the latter only if fixed string matching is used. Allow it for -S and regular expression matching as well to make the support complete. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Mar 22, 2014 at 18:15 UTC
218c45a45c4e1c3b09a1b6b2bc6e6ed457e38a9f
2 files changed
+9
-1
diffcore-pickaxe.c
+4
-1
@@ -237,7 +237,10 @@ static void diffcore_pickaxe_count(struct diff_options *o)
237
238
if (opts & DIFF_PICKAXE_REGEX) {
239
int err;
240
- err = regcomp(®ex, needle, REG_EXTENDED | REG_NEWLINE);
240
+ int cflags = REG_EXTENDED | REG_NEWLINE;
241
+ if (DIFF_OPT_TST(o, PICKAXE_IGNORE_CASE))
242
+ cflags |= REG_ICASE;
243
+ err = regcomp(®ex, needle, cflags);
244
if (err) {
245
/* The POSIX.2 people are surely sick */
246
char errbuf[1024];
t/t4209-log-pickaxe.sh
+5
@@ -88,6 +88,11 @@ test_log expect_second -S Picked
88
test_log_icase expect_second -S picked
89
test_log_icase expect_nomatch -S pickle
90
91
+test_log expect_nomatch -S p.cked --pickaxe-regex
92
+test_log expect_second -S P.cked --pickaxe-regex
93
+test_log_icase expect_second -S p.cked --pickaxe-regex
94
+test_log_icase expect_nomatch -S p.ckle --pickaxe-regex
95
+
96
test_expect_success 'log -S --textconv (missing textconv tool)' '
97
echo "* diff=test" >.gitattributes &&
98
test_must_fail git -c diff.test.textconv=missing log -Sfoo &&