From: Matthieu Moy Date: Wed, 14 May 2014 18:15:19 GMT Subject: Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option Message-ID: In-Reply-To: Junio C Hamano writes: > Stepan Kasal writes: > >> From: Johannes Schindelin >> Date: Tue, 8 Feb 2011 00:17:24 -0600 >> >> Signed-off-by: Johannes Schindelin >> Signed-off-by: Stepan Kasal >> --- >> Hi, >> this patch has been in msysgit for 3 1/4 years. >> Stepan >> >> builtin/grep.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/builtin/grep.c b/builtin/grep.c >> index 8073fbe..6c82a29 100644 >> --- a/builtin/grep.c >> +++ b/builtin/grep.c >> @@ -897,6 +897,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix) >> if (len > 4 && is_dir_sep(pager[len - 5])) >> pager += len - 4; >> >> + if (opt.ignore_case && !strcmp("less", pager)) >> + string_list_append(&path_list, "-i"); > > I have a feeling that this goes against the recent trend of not > mucking with the expectation of the users on their pagers, if I > recall correctly the arguments for dropping S from the default given > to an unconfigured LESS environment variable. I had the same feeling about "we're doing magic in corner-cases, makes it hard for the user to understand what's going on". But the patch actually makes a lot of sense. Without the patch, I get $ git grep -O -i no_openssl Pattern not found (press RETURN) with the patch, I do get a file opened and NO_OPENSSL selected. The lines right below the ones of the patch are aleady (documented) less+vi magic, which actually require the patch to behave well in the presence of -i. -- Matthieu Moy http://www-verimag.imag.fr/~moy/