public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web•de>
To: "D. Ben Knoble" <ben.knoble@gmail•com>
Cc: Git <git@vger•kernel.org>,
	Phillip Wood <phillip.wood@dunelm•org.uk>,
	Junio C Hamano <gitster@pobox•com>, Jeff King <peff@peff•net>
Subject: Re: [PATCH v2] diff: disable rename detection with --quiet
Date: Sun, 9 Nov 2025 19:35:12 +0100	[thread overview]
Message-ID: <916cf3cc-185f-447d-845d-a65eddee4a36@web.de> (raw)
In-Reply-To: <CALnO6CC+ke1L7T+dO13B0FSjLyJqihKHKZaa-B4dh9guxk7z0Q@mail.gmail.com>

On 11/9/25 6:34 PM, D. Ben Knoble wrote:
> On Sun, Nov 9, 2025 at 11:43 AM René Scharfe <l.s.r@web•de> wrote:
>>
>> This actually fixes the error code when using the options --cached,
>> --find-copies-harder, --no-ext-diff and --quiet together:
>> run_diff_index() indirectly calls diff-lib.c::show_modified(), which
>> queues even non-modified entries using diff_change() because we need
>> them for copy detection.  diff_change() sets flags.has_changes, though,
>> which causes diff_can_quit_early() to declare we're done after seeing
>> only the very first entry -- way too soon.
> 
> This does describe the behavior I saw, but it seems to me that, if we
> have changes, then we ought to be able to quit early for --quiet, no?
> 
> So there's some other knock-on effect that causes quitting early to be
> wrong here, and I'm not exactly sure what it is (other than the diff
> queues being different sizes when we hit relevant parts of
> diffcore_std, though it's the working case that has the larger queue).
> So I'm having a hard time tying this paragraph to the actual issue
> (mostly due to my complete unfamiliarity with the diffing subsystem).

run_diff_index() calls diff-lib.c::diff_cache() to queue up index
entries.  As mentioned above it only queues up the very first one, no
matter if it's a change or not.  In Git's repo this would be
.cirrus.yml.  That's not the end of it, yet, though.  It then calls
diffcore_std(), which calls diffcore_rename() to remove non-changes
from the queue and overwrites flags.has_changes based on whether the
queue is empty now.

René


  reply	other threads:[~2025-11-09 18:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-08 19:05 diff --cached --no-ext-diff --find-copies-harder --quiet exits with wrong status code D. Ben Knoble
2025-11-08 19:08 ` D. Ben Knoble
2025-11-08 19:12   ` D. Ben Knoble
2025-11-09 12:11 ` [PATCH] diff: disabled quick optimization with --find-copies-harder René Scharfe
2025-11-09 14:18   ` Phillip Wood
2025-11-09 16:43     ` René Scharfe
2025-11-09 16:43 ` [PATCH v2] diff: disable rename detection with --quiet René Scharfe
2025-11-09 17:34   ` D. Ben Knoble
2025-11-09 18:35     ` René Scharfe [this message]
2025-11-10 23:58       ` D. Ben Knoble
2025-11-10  9:42     ` Phillip Wood
2025-11-10 17:54   ` Jeff King
2025-11-10 19:13     ` Junio C Hamano
2025-11-22 21:44     ` René Scharfe
2025-11-23  7:09       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=916cf3cc-185f-447d-845d-a65eddee4a36@web.de \
    --to=l.s.r@web$(echo .)de \
    --cc=ben.knoble@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=peff@peff$(echo .)net \
    --cc=phillip.wood@dunelm$(echo .)org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox