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

Diff rename detection performance issues

From
DDDevste Devste <devstemail@gmail.com>
Date
Feb 23, 2025, 10:29 UTC
Message-ID
<CANM0SV2XOTQ2Mna1B_sX0EF0ffohcrexh1EO5d4G0=sqdmxQtA@mail.gmail.com>

I have a merge commit that includes 2 modified (!) files: hello/foo/stubs/example.php hello/world.php

I want to only get the changes introduced by the merge commit and exclude any changes in /foo/stubs/: git diff -l0 --name-status --find-renames "$sha"^'!' -- ':!*/foo/stubs/*'

Git takes more than 4 minutes to generate this diff, since hello/foo/stubs/example.php is a huge file. When using --no-renames (instead of --find-renames) it's much, much faster. And without the example.php file, the diff takes less than 1 second instead of 4+ minutes.

Funnily enough, when I have a merge commit that contains only that 1 excluded file, it's the same behavior.

1) if there's only a single file in a commit, why does --find-renames
cause a slowdown? There's nothing that could have been renamed in that
case (probably the same for --find-copies)
2) could rename detection be "delayed" to only run/check if there are
actually additions/deletions (and possibly only check those)? If a
commit only contains modifications (unlike in a really, really 0.0001%
edge case) but no additions+deletions it's extremely unlikely that
there's a rename, so detection could be skipped altogether?
Next: Elijah Newren
Message 1 of 3 in “Diff rename detection performance issues”
  1. Devste DevsteFeb 23, 2025
  2. Elijah NewrenFeb 24, 2025
  3. D. Ben KnobleFeb 24, 2025

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.