git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: git@vger.kernel.org, stolee@gmail.com
Subject: Re: [PATCH v2] cache-tree: do not lazy-fetch merge tree
Date: Mon, 09 Sep 2019 12:55:26 -0700	[thread overview]
Message-ID: <xmqqsgp5i6s1.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20190909190130.146613-1-jonathantanmy@google.com> (Jonathan Tan's message of "Mon, 9 Sep 2019 12:01:30 -0700")

Jonathan Tan <jonathantanmy@google.com> writes:

> When cherry-picking (for example), new trees may be constructed. During
> this process, Git constructs the new tree in a struct strbuf, computes
> the OID of the new tree, and checks if the new OID already exists on
> disk. However, in a partial clone, the disk check causes a lazy fetch to
> occur, which is both unnecessary (because we have the tree in the struct
> strbuf) and likely to fail (because the remote probably doesn't have
> this tree).

I somehow smell that the above misses the point of the check in the
first place, though.  The reason why we are computing the tree
object's name and seeing if we have it locally on disk is to decide
if we want to record it in the cache tree, *without* writing the
tree out to our object store, no?

It is not just unnecessary but also against the goal of the codepath
to lazily download it, even if the tree is available remotely.  And
it is irrelevant that there are cases the remote does not have
it---we have no need to mention that we must be prepared to see the
lazy fetch to fail.  Even when they do have one, we do not want to
fetch it and write to our object store.

Isn't that what is going on?  I thought I dug up the original that
introduced the has_object_file() call to this codepath to make sure
we understand why we make the check (and I expected the person who
is proposing this change to do the same and record the finding in
the proposed log message).

I am running out of time today, and will revisit later this week
(I'll be down for at least two days starting tomorrow, by the way).

Thanks.

  reply	other threads:[~2019-09-09 19:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03 19:42 [PATCH] cache-tree: do not lazy-fetch merge tree Jonathan Tan
2019-09-04  1:37 ` Derrick Stolee
2019-09-04 22:35   ` Jonathan Tan
2019-09-04 23:35     ` Junio C Hamano
2019-09-09 19:01 ` [PATCH v2] " Jonathan Tan
2019-09-09 19:55   ` Junio C Hamano [this message]
2019-09-09 21:05     ` Junio C Hamano
2019-09-09 22:21       ` Jeff King
2019-09-10  1:09         ` Junio C Hamano
2019-09-10 18:15       ` Jonathan Tan
2019-09-10 12:49   ` SZEDER Gábor
2019-09-10 18:19     ` Jonathan Tan

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=xmqqsgp5i6s1.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    --cc=stolee@gmail.com \
    /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).