From: Derrick Stolee <firstname.lastname@example.org>
To: Jeff King <email@example.com>,
Derrick Stolee via GitGitGadget <firstname.lastname@example.org>
Cc: email@example.com, Jonathan Tan <firstname.lastname@example.org>,
Taylor Blau <email@example.com>,
Derrick Stolee <firstname.lastname@example.org>,
Derrick Stolee <email@example.com>
Subject: Re: [PATCH] clone: --filter=tree:0 implies fetch.recurseSubmodules=no
Date: Mon, 23 Nov 2020 10:18:42 -0500 [thread overview]
Message-ID: <firstname.lastname@example.org> (raw)
On 11/20/2020 7:04 PM, Jeff King wrote:
> On Fri, Nov 20, 2020 at 08:36:26PM +0000, Derrick Stolee via GitGitGadget wrote:
>> I decided that even if I did populate the submodules, the nature of
>> treeless clones makes me not want to care about the contents of commits
>> other than those that I am explicitly navigating to.
>> This loop of tree fetches can be avoided by adding
>> --no-recurse-submodules to the 'git fetch' command or setting
>> To make this as painless as possible for future users of treeless
>> clones, automatically set fetch.recurseSubmodules=no at clone time.
> I think it's definitely worth adjusting the defaults here to make this
> less painful out of the box. But I wonder if this is too big a hammer,
> and the on-demand logic just needs to be a bit less aggressive.
Yes, you are probably right.
I really should have labeled this patch as "RFC" as that was my intent.
> If I clone with tree:0, I'm still going to get the tree for the thing
> I'm actually checking out (assuming a non-bare repo). It would be
> reasonable to recursively fetch the submodules in that commit to
> check them out (assuming you specified --recurse-submodules).
> If I then fetch again, I'll end up with another tree that I'm about to
> checkout. So likewise, would it make sense to fetch any updates from
One thing that is different is that we will fetch the trees we need
_during that checkout_, so why do it preemptively in the fetch?
Further, the number of trees being fetched is _not_ the number of ref
tips, but seems to be related to the total number of commits different.
There must be a rev walk looking for which commits changed the modules
file or the commit link in the root tree.
> I.e., I think the problem is that whether or not cared about submodules
> in the first place, the default "on-demand" setting of fetch.submodules
> is very eager to poke through history looking at the .gitmodules file to
> see if there is anything worth also fetching. But:
> - if we know there are no active submodules in the first place
> (because you did not say --recurse-submodules), should it skip that
> poking? That seems like it shouldn't be too hard.
This is a good direction to pursue.
> - during its poking, should it set the necessary variables so that it
> never demand-fetches from a promisor remote? I suspect this part
> may be hard, because "fetch" and "checkout" are distinct operations
> (so during the "fetch" we don't yet have the new tree demand-fetched
> by checkout; in fact the user might not even be interested in
> checking it out yet).
I also think this is a good idea. In particular, should we consider
making the "submodule fetch" be part of the "promisor"? That is, we
only fetch our submodule on checkout? Can we assume that the commit
will still exist on the remote, to some extent?
Naturally, this only really applies for --filter=tree:0, since in cases
like blobless clones, we would still want the commits and trees from the
> Given the difficulties in the latter case, this may be the best we can
> do. But in that case, what happens when we _do_ care about submodules,
> and do:
> git clone --recurse-submodules --filter=tree:0 ...
> git fetch
> git merge origin
> Will we correctly fetch-on-demand the submodules we need during the
> merge operation? If so, then that user experience is probably pretty
Hopefully. Notably, the filter option does _not_ apply recursively
to the submodules, so even if we try to make the superproject a partial
clone, the submodule is not partial.
More research is required. Let's drop this patch, as I don't currently
have time to do the necessary deep dive. If someone else has time to
look into this, I'd be happy to review a better patch.
next prev parent reply other threads:[~2020-11-23 15:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-20 20:36 Derrick Stolee via GitGitGadget
2020-11-21 0:04 ` Jeff King
2020-11-23 15:18 ` Derrick Stolee [this message]
2020-11-24 8:04 ` Jeff King
2020-11-21 16:19 ` Philippe Blain
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:
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 \
* 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 inbox:
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).