Thread (1 message) 1 message, 1 author, 2018-05-10

Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'

From: Junio C Hamano <hidden>
Date: 2018-05-10 06:43:35

René Scharfe [off-list ref] writes:
Am 10.05.2018 um 02:04 schrieb Junio C Hamano:
...
quoted
     $ git grep -v second
     $ git grep --not -e second

may hit all lines in this message (except for the obvious two
lines), but we cannot say which column we found a hit.  I am
wondering if it is too grave a sin to report "the whole line is what
satisfied the criteria given" and say the match lies at column #1.
And if we are planning to use this to implement '-o', then I'd
suggest that we'd say the matched part of the line is the whole
thing (i.e. so is column #1, eo is at the eol).
quoted
By doing so, obviously we can sidestep the whole "this mode is
sometimes incompatible" and "I need to compute a lot to see if the
given expression is compatible or not" issues.
FWIW, Silver Searcher 2.1.0 does just that:

	$ echo a | ag --column -v b
	1:a

ripgrep 0.8.1 as well:

	$ echo a | rg --column -v b
	1:1:a
Thanks for additional datapoints.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help