From: Duy Nguyen <pclouds@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: [BUG?] fetch into shallow sends a large number of objects
Date: Thu, 10 Mar 2016 19:20:20 +0700 [thread overview]
Message-ID: <20160310122020.GA24007@lanh> (raw)
In-Reply-To: <20160308132524.GA22866@sigill.intra.peff.net>
On Tue, Mar 08, 2016 at 08:25:24AM -0500, Jeff King wrote:
> I think this patch does roughly the right thing:
>
> diff --git a/upload-pack.c b/upload-pack.c
> index 4859535..da76f70 100644
> --- a/upload-pack.c
> +++ b/upload-pack.c
> @@ -833,12 +833,41 @@ static void receive_needs(void)
> deepen_by_rev_list(av.argc, av.argv, &shallows);
> argv_array_clear(&av);
> }
> - else
> - if (shallows.nr > 0) {
> - int i;
> - for (i = 0; i < shallows.nr; i++)
> - register_shallow(shallows.objects[i].item->oid.hash);
> + else if (shallows.nr > 0) {
> + struct rev_info revs;
> + struct argv_array av = ARGV_ARRAY_INIT;
> + struct commit *c;
> + int i;
> +
> + argv_array_push(&av, "rev-list");
> + argv_array_push(&av, "--boundary");
Nice. I didn't know about --boundary. But will it work correctly in
this case?
--- B ---- C ---- F
/ /
--- D ---- E ---- G
C and D will be current shallow cut points. People "want" F and G.
"rev-list --boundary F G ^C ^D" would mark E as boundary/shallow too,
correct? If so the history from G will be one depth short on a normal
fetch.
> + for (i = 0; i < want_obj.nr; i++) {
> + struct object *o = want_obj.objects[i].item;
> + argv_array_push(&av, oid_to_hex(&o->oid));
> }
> + for (i = 0; i < shallows.nr; i++) {
> + struct object *o = shallows.objects[i].item;
> + argv_array_pushf(&av, "^%s", oid_to_hex(&o->oid));
> + }
> +
> + init_revisions(&revs, NULL);
> + setup_revisions(av.argc, av.argv, &revs, NULL);
> + if (prepare_revision_walk(&revs))
> + die("revision walk setup failed");
> +
> + while ((c = get_revision(&revs))) {
> + if (!(c->object.flags & BOUNDARY))
> + continue;
> + register_shallow(c->object.oid.hash);
> + packet_write(1, "shallow %s",
> + oid_to_hex(&c->object.oid));
> + }
> ...
> _But_, the client is not prepared to handle this. We send "shallow"
> lines that it is not expecting, since it did not ask for any depth. So I
> think this logic would have to kick in only when the client tells us to
> do so.
Urgh.. not good. Perhaps a new extension to let the server know the
client can handle spontaneous "deepen" commands and only activate new
mode when the extension is present?
> So what next? I think there's some protocol work here, and I think the
> overall design of that needs to be considered alongside the other
> "deepen" options your topic in pu adds (and of which I'm largely
> ignorant). Does this sufficiently interest you to pick up and roll into
> your other shallow work?
I can pick it up if you are busy with other stuff. But I'm also having
a couple other topics at the moment, so it may not progress very fast.
--
Duy
next prev parent reply other threads:[~2016-03-10 12:20 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
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 [this message]
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=20160310122020.GA24007@lanh \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.