2

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?

abyss.7
  • 13,882
  • 11
  • 56
  • 100

1 Answers1

0

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Wow, 2000+ lines of C code... But, may be, I will try to propose the patch for the following way: `-L start_regex,end_regex[,num_of_matches]` - if number of matches is not specified, then output all matches. But I don't know how should one handle overlapping ranges... – abyss.7 Dec 19 '13 at 10:07