Re: [PATCH v5 5/7] builtin/grep.c: add '--column' option to 'git-grep(1)'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 12, 2018, 05:08 UTC
- Message-ID
- <xmqqbmdlfokf.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180512032733.GA65308@syl.local>
Taylor Blau <me@ttaylorr.com> writes:
Show 12 quoted lines
>> $ 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. > > I think that is sensible. I previously was opposed to this because I > thought that it would be too difficult to script around the 'sometimes > we have columns but other times not' and 'I gave --column' but have to > check whether or not they are really there.
I am not sure if you really got what I meant. I am suggesting that "git grep -v --column second" should report that the entire line has hit for each and every line that does not have "second" on it, which is a good answer and eliminate "sometimes there is column answer (or answer to -o query) and sometimes not" at the same time.
Show 5 quoted lines
> In other terms: > > * not giving '--column' will _never_ give a column, > * '--column --invert' will _always_ die(), and > * '--column --[and | or | not]' will _never_ give a column.
So this is completely opposite from what I would have expected. to somebody who said "I think that is sensible." over there.