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, 00:04 UTC
- Message-ID
- <xmqqefikl6jx.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180509235251.GC68889@syl.local>
Taylor Blau <me@ttaylorr.com> writes:
> This check we should retain and change the wording to mention '--and', > '--or', and '--not' specifically.
Why are these problematic in the first place? If I said
$ git grep -e first --and -e these
$ git grep -e first --and --not -e those
$ git grep -e first --or -e thoseI'd expect that the first line of this paragraph will hit, and the first hit for these three are "these", "first" and "first", respectively. Most importantly, in the last one, "--or" can be omitted and the whole thing stops being "extended", so rejecting extended as a whole does not make much sense.
$ git grep -v second
$ git grep --not -e secondmay 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.
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.