From: Martin Ågren Date: Sat, 14 Nov 2020 15:32:07 GMT Subject: Re: phpdoc diff in git -L is not the correct one Message-ID: In-Reply-To: <348a2a4a-dfdb-190b-edac-01e9ad4c2d4d@greg0ire.fr> Hi greg0ire, On Sat, 14 Nov 2020 at 14:28, Grégoire PARIS 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 : is given in place of and , it is a regular expression that denotes the range from the first funcname line that matches , 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 , then a negative offset for : 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 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 and . Martin