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

Re: [bug] git log --invert-grep --grep=[sufficiently complicated regex] prints nothing

From
ZWZack Weinberg <zack@owlfolio.org>
Date
Nov 24, 2022, 13:36 UTC
Message-ID
<cfbd647e-0e66-4417-8c94-c8cac905a78a@app.fastmail.com>
In-Reply-To
<909b0770-2ac2-1a87-498b-0537a94e94ac@dunelm.org.uk>
On Thu, Nov 24, 2022, at 5:31 AM, Phillip Wood wrote:
> I think the problem is that you are excluding the commit that renames 
> the file and that stops --follow from following the rename. See below 
> for a simple reproduction using git's test suite.

Yes, I can confirm. Both of the "incorrect output" examples I gave involved excluding a commit that renames the file. If I don't do that there is no problem with an `a|b|c` regex.

> I'm afraid I'm not 
> familiar with the --follow code so I've no idea how to fix this.

I'm honestly unsure what the right behavior _should_ be, now. I expected --grep to be applied very late in the process, after the set of commits touching the specified file had already been computed (including all of its previous names, because of --follow) but the documentation is ambiguous.

zw
Previous: Phillip WoodNext: Ævar Arnfjörð Bjarmason
Message 3 of 5 in “[bug] git log --invert-grep --grep=[sufficiently complicated regex] prints nothing”
  1. Zack WeinbergNov 23, 2022
  2. Phillip WoodNov 24, 2022
  3. Zack WeinbergNov 24, 2022
  4. Ævar Arnfjörð BjarmasonNov 24, 2022
  5. Jeff KingNov 24, 2022

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.