Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Stepan Kasal <kasal@xxxxxx> writes:
>
>> From: Johannes Schindelin <johannes.schindelin@xxxxxx>
>> Date: Tue, 8 Feb 2011 00:17:24 -0600
>>
>> Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
>> Signed-off-by: Stepan Kasal <kasal@xxxxxx>
>> ---
>> 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/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]