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

Re: [PATCH v2] diff: disable rename detection with --quiet

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 23, 2025, 07:09 UTC
Message-ID
<xmqqpl99z0m5.fsf@gitster.g>
In-Reply-To
<8cc12ef2-1d2c-4924-b130-bd740a975ce0@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 12 quoted lines
> --- >8 ---
> Subject: [PATCH] diff-index: don't queue unchanged filepairs with diff_change()
>
> diff_cache() queues unchanged filepairs if the flag find_copies_harder
> is set, and uses diff_change() for that.  This function does a few
> things that are unnecessary for unchanged filepairs and always sets the
> diff_flag has_changes, which is simply misleading in this case.
>
> Add a new streamlined function for queuing unchanged filepairs and
> use it in show_modified(), which is called by diff_cache() via
> oneway_diff() and do_oneway_diff().  It allocates only one half of each
> filepair, ...

It's a misleading thing to say. It allocates a full filepair, but because a filespec is reference counted, it can reuse the same filespec to hold both preimage and postimage, halving the memory requirement without leading to double freeing. And having a separete helper do so would make it almost trivial to avoid setting the has_changes bit.

Cleverly done.
Thanks.
> ... which has a measurable effect if there are a lot of them, like
> in the Linux repo:
Previous: René Scharfe
Message 15 of 15 in “diff --cached --no-ext-diff --find-copies-harder --quiet exits with wrong status code”
  1. D. Ben KnobleNov 8, 2025
  2. D. Ben KnobleNov 8, 2025
  3. D. Ben KnobleNov 8, 2025
  4. diff: disabled quick optimization with --find-copies-harderRené Scharfe, Nov 9, 2025
  5. Phillip WoodNov 9, 2025
  6. René ScharfeNov 9, 2025
  7. diff: disable rename detection with --quietRené Scharfe, Nov 9, 2025
  8. D. Ben KnobleNov 9, 2025
  9. René ScharfeNov 9, 2025
  10. D. Ben KnobleNov 10, 2025
  11. Phillip WoodNov 10, 2025
  12. Jeff KingNov 10, 2025
  13. Junio C HamanoNov 10, 2025
  14. René ScharfeNov 22, 2025
  15. Junio C HamanoNov 23, 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.