All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
@ 2014-05-14 15:50 Stepan Kasal
  2014-05-14 17:57 ` Junio C Hamano
  0 siblings, 1 reply; 14+ messages in thread
From: Stepan Kasal @ 2014-05-14 15:50 UTC (permalink / raw)
  To: GIT Mailing-list; +Cc: Johannes Schindelin, msysGit

From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Tue, 8 Feb 2011 00:17:24 -0600

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
---
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");
+
 		if (!strcmp("less", pager) || !strcmp("vi", pager)) {
 			struct strbuf buf = STRBUF_INIT;
 			strbuf_addf(&buf, "+/%s%s",
-- 
1.9.2.msysgit.0.335.gd2a461f

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-14 15:50 [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option Stepan Kasal
@ 2014-05-14 17:57 ` Junio C Hamano
  2014-05-14 18:15   ` Matthieu Moy
  2014-05-14 18:26   ` Jonathan Nieder
  0 siblings, 2 replies; 14+ messages in thread
From: Junio C Hamano @ 2014-05-14 17:57 UTC (permalink / raw)
  To: Stepan Kasal; +Cc: GIT Mailing-list, Johannes Schindelin, msysGit

Stepan Kasal <kasal@ucw.cz> writes:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> Date: Tue, 8 Feb 2011 00:17:24 -0600
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Stepan Kasal <kasal@ucw.cz>
> ---
> 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.

>  		if (!strcmp("less", pager) || !strcmp("vi", pager)) {
>  			struct strbuf buf = STRBUF_INIT;
>  			strbuf_addf(&buf, "+/%s%s",
> -- 
> 1.9.2.msysgit.0.335.gd2a461f
>
> -- 

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-14 17:57 ` Junio C Hamano
@ 2014-05-14 18:15   ` Matthieu Moy
  2014-05-14 18:26   ` Jonathan Nieder
  1 sibling, 0 replies; 14+ messages in thread
From: Matthieu Moy @ 2014-05-14 18:15 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Stepan Kasal, GIT Mailing-list, Johannes Schindelin, msysGit

Junio C Hamano <gitster@pobox.com> writes:

> Stepan Kasal <kasal@ucw.cz> writes:
>
>> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>> Date: Tue, 8 Feb 2011 00:17:24 -0600
>>
>> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>> Signed-off-by: Stepan Kasal <kasal@ucw.cz>
>> ---
>> 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/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-14 17:57 ` Junio C Hamano
  2014-05-14 18:15   ` Matthieu Moy
@ 2014-05-14 18:26   ` Jonathan Nieder
  2014-05-14 18:33     ` Junio C Hamano
                       ` (2 more replies)
  1 sibling, 3 replies; 14+ messages in thread
From: Jonathan Nieder @ 2014-05-14 18:26 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Stepan Kasal, GIT Mailing-list, Johannes Schindelin, msysGit

Hi,

Junio C Hamano wrote:
> Stepan Kasal <kasal@ucw.cz> writes:

>> --- 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.

It's just missing an explanation.

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.
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.
(That's -I, not -i, because it ought to work even when the pattern
contains capital letters.)

"git grep" has other options that affect interpretation of the pattern
which this patch does not help with:

 * -v / --ignore-match: probably should disable this feature of -O.
 * -E / --extended-regexp
 * -P / --perl-regexp
 * -F / --fixed-strings: ideally would auto-escape regex specials.
 * -e<pattern1> --or -e<pattern2>

And git grep -Ovi has a similar bug, for which the fix is to add
\c to the pattern instead of passing an -I option.

But as is, it's an improvement, so (except that "-i" should be
replaced by "-I") it seems like a good change.

Hope that helps,
Jonathan

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-14 18:26   ` Jonathan Nieder
@ 2014-05-14 18:33     ` Junio C Hamano
  2014-05-15 17:44       ` Johannes Schindelin
  2014-05-14 18:35     ` Stepan Kasal
  2014-05-14 19:07     ` Jeff King
  2 siblings, 1 reply; 14+ messages in thread
From: Junio C Hamano @ 2014-05-14 18:33 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Stepan Kasal, GIT Mailing-list, Johannes Schindelin, msysGit

Jonathan Nieder <jrnieder@gmail.com> writes:

>>> +		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.
>
> It's just missing an explanation.
> ...
> (That's -I, not -i, because it ought to work even when the pattern
> contains capital letters.)

Spot on.  The change, especially with "-I", makes sense.

Thanks.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-14 18:26   ` Jonathan Nieder
  2014-05-14 18:33     ` Junio C Hamano
@ 2014-05-14 18:35     ` Stepan Kasal
  2014-05-14 19:07     ` Jeff King
  2 siblings, 0 replies; 14+ messages in thread
From: Stepan Kasal @ 2014-05-14 18:35 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Junio C Hamano, GIT Mailing-list, Johannes Schindelin, msysGit

Hello,

On Wed, May 14, 2014 at 11:26:54AM -0700, Jonathan Nieder wrote:
> But as is, it's an improvement, so (except that "-i" should be
> replaced by "-I") it seems like a good change.

indeed, "-I" would match the semantics of git-grep -i .

Stepan

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-14 18:26   ` Jonathan Nieder
  2014-05-14 18:33     ` Junio C Hamano
  2014-05-14 18:35     ` Stepan Kasal
@ 2014-05-14 19:07     ` Jeff King
  2014-05-15 17:46       ` Johannes Schindelin
  2 siblings, 1 reply; 14+ messages in thread
From: Jeff King @ 2014-05-14 19:07 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Junio C Hamano, Stepan Kasal, GIT Mailing-list,
	Johannes Schindelin, msysGit

On Wed, May 14, 2014 at 11:26:54AM -0700, Jonathan Nieder wrote:

> "git grep" has other options that affect interpretation of the pattern
> which this patch does not help with:
> 
>  * -v / --ignore-match: probably should disable this feature of -O.
>  * -E / --extended-regexp
>  * -P / --perl-regexp
>  * -F / --fixed-strings: ideally would auto-escape regex specials.
>  * -e<pattern1> --or -e<pattern2>
> 
> And git grep -Ovi has a similar bug, for which the fix is to add
> \c to the pattern instead of passing an -I option.

We've already found the lines of interest to the user. It would be nice
if we could somehow point the pager at them by number, rather than
repeating the (slightly incompatible) search.

We can do "less +25", but that only points it to the first instance (and
doesn't highlight it), whereas the current code lets the repeat-search
find other instances. I don't think there's a way to queue up a set of
interesting lines to visit in less. At least I could not think of one.

This is more or less how I ended up at the design of contrib/git-jump,
which uses quickfix lists to make such a queue (only editors
understand those, not pagers, but I consider being dumped into the
editor a feature :) ).

> But as is, it's an improvement, so (except that "-i" should be
> replaced by "-I") it seems like a good change.

Agreed. Thanks for the list of problematic options.

-Peff

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-14 18:33     ` Junio C Hamano
@ 2014-05-15 17:44       ` Johannes Schindelin
  2014-05-15 17:53         ` Jonathan Nieder
  2014-05-15 19:48         ` Junio C Hamano
  0 siblings, 2 replies; 14+ messages in thread
From: Johannes Schindelin @ 2014-05-15 17:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonathan Nieder, Stepan Kasal, GIT Mailing-list, msysGit

Hi Junio,

On Wed, 14 May 2014, Junio C Hamano wrote:

> Jonathan Nieder <jrnieder@gmail.com> writes:
> 
> >>> +		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.
> >
> > It's just missing an explanation.
> > ...
> > (That's -I, not -i, because it ought to work even when the pattern
> > contains capital letters.)
> 
> Spot on.  The change, especially with "-I", makes sense.

Except that it was not tested with -I. If you change it that way and it
stops working on Windows, it's useless to me.

Ciao,
Johannes

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-14 19:07     ` Jeff King
@ 2014-05-15 17:46       ` Johannes Schindelin
  2014-05-15 17:56         ` Jonathan Nieder
  2014-05-15 19:18         ` Jeff King
  0 siblings, 2 replies; 14+ messages in thread
From: Johannes Schindelin @ 2014-05-15 17:46 UTC (permalink / raw)
  To: Jeff King
  Cc: Jonathan Nieder, Junio C Hamano, Stepan Kasal, GIT Mailing-list, msysGit

Hi Peff,

On Wed, 14 May 2014, Jeff King wrote:

> On Wed, May 14, 2014 at 11:26:54AM -0700, Jonathan Nieder wrote:
> 
> > "git grep" has other options that affect interpretation of the pattern
> > which this patch does not help with:
> > 
> >  * -v / --ignore-match: probably should disable this feature of -O.
> >  * -E / --extended-regexp
> >  * -P / --perl-regexp
> >  * -F / --fixed-strings: ideally would auto-escape regex specials.
> >  * -e<pattern1> --or -e<pattern2>
> > 
> > And git grep -Ovi has a similar bug, for which the fix is to add
> > \c to the pattern instead of passing an -I option.
> 
> We've already found the lines of interest to the user. It would be nice
> if we could somehow point the pager at them by number, rather than
> repeating the (slightly incompatible) search.

FWIW it is exactly that type of "I want your patch to do more than you do"
type of comments that makes it impossible for myself to contribute patches
anymore. It just does not fit inside my Git time budget anymore.

Besides, it breaks exactly the intended usage. My intent is not just to
see the matching lines in the pager, but to be able to adjust the search
pattern further if needed. Your suggestion completely breaks that usage.

Ciao,
Johannes

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-15 17:44       ` Johannes Schindelin
@ 2014-05-15 17:53         ` Jonathan Nieder
  2014-05-15 19:01           ` Johannes Schindelin
  2014-05-15 19:48         ` Junio C Hamano
  1 sibling, 1 reply; 14+ messages in thread
From: Jonathan Nieder @ 2014-05-15 17:53 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Junio C Hamano, Stepan Kasal, GIT Mailing-list, msysGit

Hi,

Johannes Schindelin wrote:
> On Wed, 14 May 2014, Junio C Hamano wrote:

>> Spot on.  The change, especially with "-I", makes sense.
>
> Except that it was not tested with -I. If you change it that way and it
> stops working on Windows, it's useless to me.

Are you saying that less on Windows doesn't have an "-I" option?
version.c tells me it was added in v266 (1994-12-26).

If "-I' is in fact broken on Windows, that would be useful to know,
but it's not clear to me.  Or if I have misunderstood what

	git grep -i -Oless -eGit_

is supposed to do, that would help, too.

Puzzled,
Jonathan

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-15 17:46       ` Johannes Schindelin
@ 2014-05-15 17:56         ` Jonathan Nieder
  2014-05-15 19:18         ` Jeff King
  1 sibling, 0 replies; 14+ messages in thread
From: Jonathan Nieder @ 2014-05-15 17:56 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Jeff King, Junio C Hamano, Stepan Kasal, GIT Mailing-list, msysGit

Johannes Schindelin wrote:
> On Wed, 14 May 2014, Jeff King wrote:

>> We've already found the lines of interest to the user. It would be nice
>> if we could somehow point the pager at them by number, rather than
>> repeating the (slightly incompatible) search.
>
> FWIW it is exactly that type of "I want your patch to do more than you do"
> type of comments that makes it impossible for myself to contribute patches
> anymore.

I think you're overreacting to Peff's "It would be nice".

It is a way of talking about where this lies in a design space that
also includes the git-jump tool that Peff worked on.  Maybe the tools
can learn from each other.  It is not a reason not to apply the patch.

Jonathan

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-15 17:53         ` Jonathan Nieder
@ 2014-05-15 19:01           ` Johannes Schindelin
  0 siblings, 0 replies; 14+ messages in thread
From: Johannes Schindelin @ 2014-05-15 19:01 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Junio C Hamano, Stepan Kasal, GIT Mailing-list, msysGit

Hi,

On Thu, 15 May 2014, Jonathan Nieder wrote:

> Johannes Schindelin wrote:
> > On Wed, 14 May 2014, Junio C Hamano wrote:
> 
> >> Spot on.  The change, especially with "-I", makes sense.
> >
> > Except that it was not tested with -I. If you change it that way and it
> > stops working on Windows, it's useless to me.
> 
> Are you saying that less on Windows doesn't have an "-I" option?

I did not say that.

> version.c tells me it was added in v266 (1994-12-26).

Thanks. That was the thing I was really looking for: an indication that -I
is not a new-fangled thing but a well-tested option that even old greps
have.

Ciao,
Dscho

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-15 17:46       ` Johannes Schindelin
  2014-05-15 17:56         ` Jonathan Nieder
@ 2014-05-15 19:18         ` Jeff King
  1 sibling, 0 replies; 14+ messages in thread
From: Jeff King @ 2014-05-15 19:18 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Jonathan Nieder, Junio C Hamano, Stepan Kasal, GIT Mailing-list, msysGit

On Thu, May 15, 2014 at 07:46:49PM +0200, Johannes Schindelin wrote:

> > We've already found the lines of interest to the user. It would be nice
> > if we could somehow point the pager at them by number, rather than
> > repeating the (slightly incompatible) search.
> 
> FWIW it is exactly that type of "I want your patch to do more than you do"
> type of comments that makes it impossible for myself to contribute patches
> anymore. It just does not fit inside my Git time budget anymore.

I'm sorry you took it that way. What I meant to say was "it would be
nice if we could do it this other way, which is more robust, but I don't
think it is easy.  Let's take the patch". I.e., when I later said:

>>> But as is, it's an improvement, so (except that "-i" should be
>>> replaced by "-I") it seems like a good change.
>>
>>Agreed. Thanks for the list of problematic options.

the "agreed" there is with "it seems like a good change".

And I also wanted to point people to existing work, if they did want to
explore doing it that other way.  I really didn't expect anything from
you (beyond s/i/I/, as Jonathan suggested).

> Besides, it breaks exactly the intended usage. My intent is not just to
> see the matching lines in the pager, but to be able to adjust the search
> pattern further if needed. Your suggestion completely breaks that usage.

Thanks, this is a point I hadn't considered.

-Peff

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option
  2014-05-15 17:44       ` Johannes Schindelin
  2014-05-15 17:53         ` Jonathan Nieder
@ 2014-05-15 19:48         ` Junio C Hamano
  1 sibling, 0 replies; 14+ messages in thread
From: Junio C Hamano @ 2014-05-15 19:48 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Jonathan Nieder, Stepan Kasal, GIT Mailing-list, msysGit

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> Jonathan Nieder <jrnieder@gmail.com> writes:
>> 
>> >>> +		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.
>> >
>> > It's just missing an explanation.
>> > ...
>> > (That's -I, not -i, because it ought to work even when the pattern
>> > contains capital letters.)
>> 
>> Spot on.  The change, especially with "-I", makes sense.
>
> Except that it was not tested with -I. If you change it that way and it
> stops working on Windows, it's useless to me.

That is all true, and I didn't test on Windows, but it seems that
the feature is very old in the upstream that we can rely on, so
let's take Jonathan's explanation and queue somethink like this.

-- >8 --
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Tue, 8 Feb 2011 00:17:24 -0600
Subject: [PATCH] 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 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/builtin/grep.c b/builtin/grep.c
index 63f8603..c0573d0 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -876,6 +876,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");
+
 		if (!strcmp("less", pager) || !strcmp("vi", pager)) {
 			struct strbuf buf = STRBUF_INIT;
 			strbuf_addf(&buf, "+/%s%s",
-- 
2.0.0-rc3-419-gdb851f2

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-05-15 19:56 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-14 15:50 [PATCH] git grep -O -i: if the pager is 'less', pass the '-i' option Stepan Kasal
2014-05-14 17:57 ` Junio C Hamano
2014-05-14 18:15   ` Matthieu Moy
2014-05-14 18:26   ` Jonathan Nieder
2014-05-14 18:33     ` Junio C Hamano
2014-05-15 17:44       ` Johannes Schindelin
2014-05-15 17:53         ` Jonathan Nieder
2014-05-15 19:01           ` Johannes Schindelin
2014-05-15 19:48         ` Junio C Hamano
2014-05-14 18:35     ` Stepan Kasal
2014-05-14 19:07     ` Jeff King
2014-05-15 17:46       ` Johannes Schindelin
2014-05-15 17:56         ` Jonathan Nieder
2014-05-15 19:18         ` Jeff King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.