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

From: Junio C Hamano <[email-masked]>
Date: Sat, 22 Nov 2025 23:09:22 -0800

René Scharfe <[email-masked]> writes:

> --- >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: