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: