Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 10, 2018, 06:43 UTC
- Message-ID
- <xmqqk1scj9il.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <4640b041-f66c-3c1f-1329-baa4580df5cc@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 9 quoted lines
> Am 10.05.2018 um 02:04 schrieb Junio C Hamano: > ... >> $ 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).
Show 13 quoted lines
>> 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.