How to see all matching ranges with git blame?

233 views Asked by At

I can output first range matching regex with a command:

git blame -L'/start_regex/','/end_regex/' file

But how to output all next ranges matching this regex in the same file?

1

There are 1 answers

1
VonC On

As far as I can see, git blame -L'/start_regex/','/end_regex/' will only return the first match.

You now can (git 1.8.5 December 2013) specify multiple ranges, since commit 58dbfa2 and Eric Sunshine's sunshine work.

So you could try (in git 1.8.5, not tested)

git blame -L'/start_regex/','/end_regex/' -L'/start_regex/','/end_regex/' file

That would check if you can get two different matches, but that doesn't scale well.

That means it could be a good idea for a patch to builtin/blame.c.