git grep -O -i: if the pager is 'less', pass the '-I' option
commitc896851d98fb2be873a435ee773474649c5821e5
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 8 Feb 2011 06:17:24 +0000 (8 00:17 -0600)
committerStepan Kasal <kasal@ucw.cz>
Thu, 29 May 2014 08:39:31 +0000 (29 10:39 +0200)
tree215977d38a41cbbb0995d5dc7ee6beda4fc7721f
parent841ca0450a2d2eaafc9c051a533181fefb66d92b
git grep -O -i: if the pager is 'less', pass the '-I' option

When <command> happens to be the magic string "less", today

git grep -O<command> -e<pattern>

helpfully passes +/<pattern> to less so you can navigate through
the results within a file using the n and shift+n keystrokes.

Alas, that doesn't do the right thing for a case-insensitive match,
i.e.

git grep -i -O<command> -e<pattern>

For that case we should pass --IGNORE-CASE to "less" so that n and
shift+n can move between results ignoring case in the pattern.

The original patch came from msysgit and used "-i", but that was not
due to lack of support for "-I" but it merely overlooked that it
ought to work even when the pattern contains capital letters.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/grep.c