Thread (1 message) 1 message, 1 author, 2025-11-23

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

From: Junio C Hamano <hidden>
Date: 2025-11-23 07:09:25

René Scharfe [off-list ref] writes:
quoted hunk
--- >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:
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help