Skip to content

Commit 75b1b04

Browse files
committed
Merge branch 'sk/spawn-less-case-insensitively-from-grep-O-i' into maint
"git grep -O" to show the lines that hit in the pager did not work well with case insensitive search. We now spawn "less" with its "-I" option when it is used as the pager (which is the default). * sk/spawn-less-case-insensitively-from-grep-O-i: git grep -O -i: if the pager is 'less', pass the '-I' option
2 parents 94c734a + f7febbe commit 75b1b04

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

builtin/grep.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
874874
if (len > 4 && is_dir_sep(pager[len - 5]))
875875
pager += len - 4;
876876

877+
if (opt.ignore_case && !strcmp("less", pager))
878+
string_list_append(&path_list, "-I");
879+
877880
if (!strcmp("less", pager) || !strcmp("vi", pager)) {
878881
struct strbuf buf = STRBUF_INIT;
879882
strbuf_addf(&buf, "+/%s%s",

0 commit comments

Comments
 (0)