Subject: Re: [PATCH v3 0/2] grep.c: teach --only-matching to 'git-grep(1)'

From: Taylor Blau <[email-masked]>
Date: Fri, 6 Jul 2018 15:15:22 -0500

On Fri, Jul 06, 2018 at 11:21:06AM -0700, Junio C Hamano wrote:
> Taylor Blau <[email-masked]> writes:
>
> > I think that this might be clear enough on its own, especially since
> > this is the same as BSD grep on my machine. I think that part_s_ of a
> > line indicates that behavior, but perhaps not. On GNU grep, this is:
> >
> >   Print only the matched (non-empty) parts of a matching line, with each
> >   such part on a separate output line.
>
> Interesting.  I wonder what "git grep -o '^'" would do ;-)

That invocation prints nothing, but on BSD grep it prints quite a few
blank lines :-).

I'm hesitant on sending a patch per the hunk of your reply below because
of this. Should we mirror BSD grep's behavior exactly here? I suppose
that we could somehow, but it seems like we might be doing too much to
support what appears to me to be an odd use-case.

> > I'm happy to pick either and re-send this patch (2/2) again, if it
> > wouldn't be too much to juggle. Otherwise, I can re-roll to v4.
>
> Please do not re-send a different version of a patch with the same
> v$n value.  Either re-send, otherwise re-roll, will give us v4, not
> v3.
>
> In any case, I find that the GNU phrasing is the most clear among
> the ones I've seen in this thread so far.

OK. I'm happy to re-send that patch with the GNU phrasing depending on
what others think (and the above). I'll let this cook and collect some
thoughts over the weekend.

Thanks,
Taylor