git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Martin Ågren" <martin.agren@gmail.com>
To: "Grégoire PARIS" <postmaster@greg0ire.fr>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: phpdoc diff in git -L is not the correct one
Date: Sat, 14 Nov 2020 16:32:07 +0100	[thread overview]
Message-ID: <CAN0heSrU5zzgR_FDZcEopPP2EmSQnraZXO4v8Smx8=fWcXa0uQ@mail.gmail.com> (raw)
In-Reply-To: <348a2a4a-dfdb-190b-edac-01e9ad4c2d4d@greg0ire.fr>

Hi greg0ire,

On Sat, 14 Nov 2020 at 14:28, Grégoire PARIS <postmaster@greg0ire.fr> wrote:
> I have recently found out about git -L , which is great! I think I have
> found a
> bug in it though: the diff is correct on the method itself, but changes
> in the
> phpdoc of the method do not seem to be taken into account, while changes
> in the
> phpdoc of the method that follows the one I care about show up in the
> diff. I
> have attached a bug report generated with git bugreport.

This seems to be behaving like documented. Quoting the man-page:

  If :<funcname> is given in place of <start> and <end>, it is a regular
  expression that denotes the range from the first funcname line that
  matches <funcname>, up to the next funcname line.

That range is exactly what you're seeing.

Now, I can certainly understand your wish of peeking backwards to
include the phpdoc for that function. You can do that using something
like

  git log -L46,76:src/Doctrine/Instantiator/Instantiator.php

but it's obviously a bit more involved to figure out which (approximate)
numbers to give.

One way of *only* looking backwards might be to use a regex for the
<start>, then a negative offset for <end>:

  git log -L/instantiate\(/,-14:src/Doctrine/Instantiator/Instantiator.php

Alas, this also requires coming up with a decent guess for how far back
to look. I can't seem to find a way of using a regex for <end> and
searching backwards -- I imagine it could be something like "-/regex/".
Anyway, that would just solve half your problem: You'd see the
documentation evolve but not the implementation.

In the end I think your best option right now is to give explicit line
numbers for <end> and <start>.

Martin

  reply	other threads:[~2020-11-14 15:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-14 13:19 phpdoc diff in git -L is not the correct one Grégoire PARIS
2020-11-14 15:32 ` Martin Ågren [this message]
2020-11-14 15:55   ` Grégoire PARIS
2020-11-14 17:35     ` Martin Ågren
2020-11-14 23:40       ` René Scharfe
2020-11-18  8:17         ` Grégoire PARIS
2020-11-18 19:18           ` Martin Ågren

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CAN0heSrU5zzgR_FDZcEopPP2EmSQnraZXO4v8Smx8=fWcXa0uQ@mail.gmail.com' \
    --to=martin.agren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=postmaster@greg0ire.fr \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).