git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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).

Previous: Dotan CohenNext: René Scharfe
Message 4 of 6 in “Git bug: Filter ignored when "--invert-grep" option is used.”
  1. Dotan CohenDec 15, 2021
  2. Junio C HamanoDec 15, 2021
  3. Dotan CohenDec 16, 2021
  4. Junio C HamanoDec 16, 2021
  5. René ScharfeDec 17, 2021
  6. Junio C HamanoDec 17, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.