Thread (6 messages) flat view 6 messages, 3 authors, 2023-09-13

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

From: Oleg Nesterov <oleg@redhat.com>
Date: 2023-09-13 10:16:49

Possibly related (same subject, not in this thread)

On 09/12, René Scharfe wrote:
quoted
quoted
So perhaps git-grep needs another change, something like

	if (match_funcname(opt, gs, bol, end_of_line(...)))
		return;

at the start of show_funcname_line(), but my patch does not change this
behaviour.
Yes, to make it match the documentation it would need something like
that.  (Though I'd add a match_funcname() call before the
show_funcname_line() call in grep_source_1() instead, as it already has
the eol value.)
Yes, I too thought about this. Except I thought that it makes sense to
pass the additional "unsigned eol" argument to show_funcname_line().
But in any case show_pre_context() will need to calculate eol.

However this is just a minor detail, I am fine either way.
quoted
So, just in case, please see V2 below. In my opinion it _fixes_ the
current behaviour. With this patch

	$ ./git grep --untracked -pn func2 TEST1.c
	TEST1.c:4:void func2()
Indeed that matches the letter of the documentation.
quoted
	$ ./git grep --untracked -pn xxx TEST2.c
	TEST2.c:1:void func(xxx)
	TEST2.c=1=void func(xxx)
	TEST2.c:3:      use(xxx);
That one as well.
So. Can I assume you agree with my patch ? ;)
No, I think the documentation is wrong.
Well, to me it looks good, but only after this patch.

Oleg.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help