From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Jan Christoph Uhde <Jan@UhdeJc.com>, git@vger.kernel.org
Subject: Re: [PATCH] diff: discard blob data from stat-unmatched pairs
Date: Tue, 02 Jun 2020 09:49:43 -0700 [thread overview]
Message-ID: <xmqqmu5ltntk.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200601202218.GA2763518@coredump.intra.peff.net> (Jeff King's message of "Mon, 1 Jun 2020 16:22:18 -0400")
Jeff King <peff@peff.net> writes:
> Subject: [PATCH] diff: discard blob data from stat-unmatched pairs
>
> When performing a tree-level diff against the working tree, we may find
> that our index stat information is dirty, so we queue a filepair to be
> examined later. If the actual content hasn't changed, we call this a
> stat-unmatch; the stat information was out of date, but there's no
> actual diff. Normally diffcore_std() would detect and remove these
> identical filepairs via diffcore_skip_stat_unmatch(). However, when
> "--quiet" is used, we want to stop the diff as soon as we see any
> changes, so we check for stat-unmatches immediately in diff_change().
>
> That check may require us to actually load the file contents into the
> pair of diff_filespecs. If we find that the pair isn't a stat-unmatch,
> then no big deal; we'd likely load the contents later anyway to generate
> a patch, do rename detection, etc, so we want to hold on to it. But if
> it a stat-unmatch, then we have no more use for that data; the whole
> point is that we're going discard the pair. However, we never free the
> allocated diff_filespec data.
Nicely spotted. So we can discard when quiet is in effect after
this check, which makes sense.
After reading the initial analysis, I wondered if the fix we did in
f34b205f (diff: do not quit early on stat-dirty files, 2014-01-25)
was suboptimal and we should have instead done the "if QUICK, check
if the pair is merely stat-unmatch" in the loop(s) that call
diff_change(), hoping that it may have given us a better control
over the lifetime of the filespecs in each diff_filepair, but I do
not think it would made much difference.
> if (options->flags.quick && options->skip_stat_unmatch &&
> - !diff_filespec_check_stat_unmatch(options->repo, p))
> + !diff_filespec_check_stat_unmatch(options->repo, p)) {
> + diff_free_filespec_data(p->one);
> + diff_free_filespec_data(p->two);
> return;
> + }
Thanks. Will queue (with that s/it/& is/ typofix mentioned
elsewhere).
prev parent reply other threads:[~2020-06-02 16:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-31 10:46 mmap failure in master 1aa69c73577df21f5e37e47cc40cf44fc049121e Jan Christoph Uhde
2020-06-01 4:45 ` Jeff King
[not found] ` <cfc79aec-ec85-dbec-e37b-6b7035b4c5a4@UhdeJc.com>
2020-06-01 16:54 ` Jeff King
2020-06-01 20:22 ` [PATCH] diff: discard blob data from stat-unmatched pairs Jeff King
2020-06-01 20:53 ` Eric Sunshine
2020-06-02 16:49 ` Junio C Hamano [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqmu5ltntk.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=Jan@UhdeJc.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).