git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Alexey Gladkov <legion@kernel.org>
Subject: Re: [PATCH 1/1] git-grep: improve the --show-function behaviour
Date: Wed, 13 Sep 2023 12:15:01 +0200	[thread overview]
Message-ID: <20230913101501.GC535@redhat.com> (raw)
In-Reply-To: <df05f761-c498-6930-bfd8-265f7e23d8ee@web.de>

On 09/12, René Scharfe wrote:
>
> >> 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.

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


      parent reply	other threads:[~2023-09-13 10:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 12:11 [PATCH 0/1] git-grep: improve the --show-function behaviour Oleg Nesterov
2023-09-11 12:12 ` [PATCH 1/1] " Oleg Nesterov
2023-09-11 20:11   ` René Scharfe
2023-09-11 21:54     ` Oleg Nesterov
2023-09-11 22:34   ` Junio C Hamano
2023-09-11 23:17     ` Oleg Nesterov
2023-09-12 13:04       ` Oleg Nesterov
2023-09-12 13:51         ` Oleg Nesterov
2023-09-12 18:07           ` René Scharfe
2023-09-13  0:31             ` Junio C Hamano
2023-09-13  9:46               ` Oleg Nesterov
2023-09-14 19:34                 ` René Scharfe
2023-09-17 16:44                   ` Oleg Nesterov
2023-09-14 19:34               ` René Scharfe
2023-09-13 10:15             ` Oleg Nesterov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230913101501.GC535@redhat.com \
    --to=oleg@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    --cc=legion@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).