Re: [PATCH 1/1] git-grep: improve the --show-function behaviour

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

 




Am 13.09.23 um 02:31 schrieb Junio C Hamano:
> René Scharfe <l.s.r@xxxxxx> writes:
>
>>>> To me, this behaviour looks as
>>>>
>>>> 		Show the preceding line that contains the function name of
>>>> 		the match, unless the _PREVIOUS_ matching line is a function
>>>> 		name itself.
>>
>> To me it looks like:
>>
>> 		Show the preceding line that contains the function name of
>> 		the match.
>>
>> ("Show" meaning "show once", not "show for each match again and again".)
>>
>> Or:
>>
>> 		Show the preceding line that contains the function name of
>> 		the match, unless it is already shown for a different
>> 		reason, e.g. as a match or as the function line of a
>> 		previous match.
>
> Wow, that was a mouthful, but matches my understanding.  I naïvely
> thought "when showing a hit, we may add the line that matches the
> function header pattern before the hit even that header line does
> not hit the grep pattern. But if the header line does hit the grep
> pattern, we do not bother show the same thing twice." was a
> reasonable goal to have.

I agree, and that's probably why I included the "unless the matching
line is a function name itself" part.  Not sure why the code doesn't
agree.  A test for that aspect would have been nice. *ahem*

René




[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]

  Powered by Linux