Re: phpdoc diff in git -L is not the correct one

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

 



Hi greg0ire,

On Sat, 14 Nov 2020 at 14:28, Grégoire PARIS <postmaster@xxxxxxxxxxx> 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




[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