Re: [PATCH 0/7] grep.c: teach --column to 'git-grep(1)'
- From
René Scharfe <l.s.r@web.de>
- Date
- Jun 19, 2018, 20:34 UTC
- Message-ID
- <385b429e-5d57-91c0-054c-0f04c59538e3@web.de>
- In-Reply-To
- <20180619191156.GA21641@sigill.intra.peff.net>
Am 19.06.2018 um 21:11 schrieb Jeff King:
Show 5 quoted lines
> On Tue, Jun 19, 2018 at 08:50:16PM +0200, René Scharfe wrote: > >> Negation causes the whole non-matching line to match, with --column >> reporting 1 or nothing in such a case, right? Or I think doing the >> same when the operator is applied a second time is explainable.
(Not sure where that extra "Or" came from.)
Show 5 quoted lines
> Yes to your first question. > > Regarding the final sentence, yes, I agree it's explainable. But I > thought that handling negation like this was one of the main complaints > of earlier iterations?
That's possible -- I didn't read the full thread, and I didn't argue for or against any specific behavior in this regard before AFAIR.
So let's see what your example does:
$ git grep --column --not \( --not -e foo --or --not -e bar \) trace.h trace.h:13: * #define foo(format, ...) bar(format, __VA_ARGS__) $ git grep --column --not \( --not -e bar --or --not -e foo \) trace.h trace.h:13: * #define foo(format, ...) bar(format, __VA_ARGS__)
Impressive. That expression is confusing at first sight, but showing the first matching column anyway requires no further explanation. I like it.
René