Skip to content

Commit 218c45a

Browse files
rscharfegitster
authored andcommitted
pickaxe: honor -i when used with -S and --pickaxe-regex
accccde (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 31a8189 commit 218c45a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

diffcore-pickaxe.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,10 @@ static void diffcore_pickaxe_count(struct diff_options *o)
237237

238238
if (opts & DIFF_PICKAXE_REGEX) {
239239
int err;
240-
err = regcomp(&regex, 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(&regex, needle, cflags);
241244
if (err) {
242245
/* The POSIX.2 people are surely sick */
243246
char errbuf[1024];

t/t4209-log-pickaxe.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ test_log expect_second -S Picked
8888
test_log_icase expect_second -S picked
8989
test_log_icase expect_nomatch -S pickle
9090

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+
9196
test_expect_success 'log -S --textconv (missing textconv tool)' '
9297
echo "* diff=test" >.gitattributes &&
9398
test_must_fail git -c diff.test.textconv=missing log -Sfoo &&

0 commit comments

Comments
 (0)