Skip to content

grep: support to match by line number

Bert Wesarg git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4grep: prepare for re-using the space of the regexp member in struct grep_patgrep.c grep.h+9 -72 replies
2/4grep: pass current line number down to match_one_patterngrep.c+21 -213 replies
3/4grep: introduce pattern which matches at line numbergrep.c grep.h+38 -22 replies
4/4grep: provide option to match line numberDocumentation/git-grep.txt builtin/grep.c+15 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH/RFC 0/4] grep: support to match by line number

This series will teach git grep to match at specified line numbers. This is particular usefull, if you want to see the lines which emits warnings or errors from a build run (where you only get the line number) and present it nicely to the user with function and context lines.

The implementation is split-up into preperation patches which are only noise:

Bert Wesarg (4):
grep: prepare for re-using the space of the regexp member in struct
grep_pat

This one moves the regexp member into an union, so that we can later re-use the space for the line number information.

grep: pass current line number down to match_one_pattern

To actually match at the line number, the function match_one_pattern needs to know the current line number, do it with this patch.

grep: introduce pattern which matches at line number

This implements the line number matching in the low level grep machinery.

grep: provide option to match line number

And lastly, this exposes the new feature by a new -@ option to git grep.

Patch 5 will than support comma separated line ranges as argument to -@, but this work has not yet started.

 Documentation/git-grep.txt |    6 +++-
 builtin/grep.c             |   10 +++++
 grep.c                     |   87 ++++++++++++++++++++++++++++++--------------
 grep.h                     |   11 ++++--
 4 files changed, 83 insertions(+), 31 deletions(-)
Signature · 1 line
1.7.5.349.gfeb1a