Re: Git bug: Filter ignored when "--invert-grep" option is used.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 16, 2021, 19:42 UTC
- Message-ID
- <xmqqee6cbalb.fsf@gitster.g>
- In-Reply-To
- <CAKDXFkOXNPTjQRvj7sy54YhH1QGFUsEXYeLKCShJP7_xueRseQ@mail.gmail.com>
Dotan Cohen <dotancohen@gmail.com> writes:
Show 7 quoted lines
>> I think --author and --grep uses the same internal pattern matching >> engine, so with --invert-grep, I would not be surprised if the >> command looks for commits that do not have Revert and (or is that >> or? I dunno) not authored by Shachar. > > Possibly, but the flag is called --invert-grep not --invert-matches so > one would expect it to revert grep only.
That is an actionable improvement idea to introduce a synonym ;-)
But in general, the way the internal "git grep" machinery is exposed to the commands in the "git log" family is very limited. With "git grep", it is quite straight-forward to say "report hits for lines that has this but not that"
$ git grep -e this --and --not -e that
but because that the commands in the "log" family already use "--not" for a quite different purpose, "git log --grep" cannot even express something similar, even to find hits on a single line, let alone finding hits on two different lines (i.e. one on the "author" header, the other in the message part, of the commit object).