From: Duy Nguyen <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, Git Mailing List <git@vger.kernel.org>
Subject: Re: [BUG?] fetch into shallow sends a large number of objects
Date: Tue, 8 Mar 2016 07:53:35 +0700 [thread overview]
Message-ID: <CACsJy8C-Wfh16jroWACEFybtnhwYX91GvgGwk8XxJRft4ZURSw@mail.gmail.com> (raw)
In-Reply-To: <xmqqio0xn93q.fsf@gitster.mtv.corp.google.com>
On Tue, Mar 8, 2016 at 6:47 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Jeff King <peff@peff.net> writes:
>
>> I don't know how the client invoked git, but we can guess what happened
>> and simulate with:
>>
>> git tag shallow ecd7ea6033fe8a05d5c21f3a54355fded6942659
>> git tag old 067f265bb512c95b22b83ccd121b9facbddcf6b1
>> git tag new d7a6d9295d718c6015be496880f1a293bdd89185
>>
>> git clone --no-local --bare --branch=shallow --depth=1 . clone.git
>> cd clone.git
>> git fetch origin old:refs/tags/old
>> git fetch origin new:refs/tags/new
>>
>> Of the two follow-up fetches in the clone, the first is reasonably fast
>> (it just grabs a few new commits on top of the shallow base), but the
>> second is expensive (it grabs the merge which pulls in the whole
>> history). If we add "--depth=1" to each of those fetches, everything
>> remains fast.
>>
>> Is this user error to call "git fetch" without "--depth" in the
>> subsequent cases? Or should git remember that we are in a shallow repo,
>> and presume that the user by default wants to keep things shallow?
>
> Hmph, you shouldn't, and I somehow thought that you do not, have to
> explicitly say things like "--deepen" to break the original
> shallowness, but your example illustrates that the logic to do so is
> not well thought out. A new side branch will prevent you from
> hitting an already-known shallow cut-off and traverse down to the
> root.
Yep. It "works" by design.
> Giving a random "depth" in subsequent fetch would however not work
> very well, I suspect, as that is very prone to make the part of the
> history the user originally obtained, and presumably used to build
> her own history, into an island that is unconnected to the updated
> tip of the history.
The new --deepen, --shallow-since and --shallow-exclude should be
better in this aspect and we can send them all the time without
affecting original cut points. Well, deepen can't be used here because
it needs shallow cut points as anchor in the first place.
> I also do not offhand think of a good way to use the topology or
> timestamp to figure out the best "depth" to truncate the side branch
> at. The server side may be able to figure out that things before 'F'
> in your picture is not relevant for a client that has the shallow
> cut-off at 067f265, but the side branch can be forked arbitrarily
> long in the past, or it may not even share the ancient part of the
> history and has its own root commit.
If a shallow point can reach root without seeing another shallow
point, we can mark all reachable commits from it shallow. If it sees
another shallow point, maybe we can mark at the merge point of them..
We can also send "here is --depth=10, but only apply it on new refs".
That should mitigate the problem a bit. But I'm not sure if I can
solve it completely.
--
Duy
next prev parent reply other threads:[~2016-03-08 0:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-07 22:15 [BUG?] fetch into shallow sends a large number of objects Jeff King
2016-03-07 23:47 ` Junio C Hamano
2016-03-08 0:53 ` Duy Nguyen [this message]
2016-03-08 12:21 ` Jeff King
2016-03-08 12:14 ` Jeff King
2016-03-08 12:33 ` Duy Nguyen
2016-03-08 13:25 ` Jeff King
2016-03-08 13:30 ` Jeff King
2016-03-08 23:02 ` Duy Nguyen
2016-03-10 12:20 ` Duy Nguyen
2016-03-10 21:10 ` Jeff King
2016-03-10 21:26 ` Junio C Hamano
2016-03-10 21:40 ` Jeff King
2016-03-11 0:47 ` Duy Nguyen
2016-03-11 16:53 ` Junio C Hamano
2016-03-11 18:16 ` Jeff King
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=CACsJy8C-Wfh16jroWACEFybtnhwYX91GvgGwk8XxJRft4ZURSw@mail.gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--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.
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 NNTP newsgroup(s).