public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail•com>
Cc: git@vger•kernel.org, Jeff King <peff@peff•net>,
	"Shawn O. Pearce" <spearce@spearce•org>
Subject: Re: [PATCH 6/6] fetch-pack: fix deepen shallow over smart http with no-done cap
Date: Thu, 06 Feb 2014 11:16:54 -0800	[thread overview]
Message-ID: <xmqqbnykyrtl.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1391699439-22781-7-git-send-email-pclouds@gmail.com> ("Nguyễn	Thái Ngọc Duy"'s message of "Thu, 6 Feb 2014 22:10:39 +0700")

Nguyễn Thái Ngọc Duy  <pclouds@gmail•com> writes:

> In smart http, upload-pack adds new shallow lines at the beginning of
> each rpc response. Only shallow lines from the first rpc call are
> useful. After that they are thrown away. It's designed this way
> because upload-pack is stateless and has no idea when its shallow
> lines are helpful or not.
>
> So after refs are negotiated with multi_ack_detailed and both sides
> happy. The server sends "ACK obj-id ready", terminates the rpc call

Is the above "... and both sides are happy, the server sends ..."?
Lack of a verb makes it hard to guess.

> and waits for the final rpc round. The client sends "done". The server
> sends another response, which also has shallow lines at the beginning,
> and the last "ACK obj-id" line.
>
> When no-done is active, the last round is cut out, the server sends
> "ACK obj-id ready" and "ACK obj-id" in the same rpc
> response. fetch-pack is updated to recognize this and not send
> "done". However it still tries to consume shallow lines, which are
> never sent.
>
> Update the code, make sure to skip consuming shallow lines when
> no-done is enabled.
>
> Reported-by: Jeff King <peff@peff•net>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail•com>
> ---

Thanks.

Do I understand the situation correctly if I said "The call to
consume-shallow-list has been here from the very beginning, but it
should have been adjusted like this patch when no-done was
introduced."?

>  fetch-pack.c             |  3 ++-
>  t/t5537-fetch-shallow.sh | 24 ++++++++++++++++++++++++
>  2 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/fetch-pack.c b/fetch-pack.c
> index 90fdd49..f061f1f 100644
> --- a/fetch-pack.c
> +++ b/fetch-pack.c
> @@ -439,7 +439,8 @@ done:
>  	}
>  	strbuf_release(&req_buf);
>  
> -	consume_shallow_list(args, fd[0]);
> +	if (!got_ready || !no_done)
> +		consume_shallow_list(args, fd[0]);
>  	while (flushes || multi_ack) {
>  		int ack = get_ack(fd[0], result_sha1);
>  		if (ack) {
> diff --git a/t/t5537-fetch-shallow.sh b/t/t5537-fetch-shallow.sh
> index b0fa738..fb11073 100755
> --- a/t/t5537-fetch-shallow.sh
> +++ b/t/t5537-fetch-shallow.sh
> @@ -200,5 +200,29 @@ EOF
>  	)
>  '
>  
> +# This test is tricky. We need large enough "have"s that fetch-pack
> +# will put pkt-flush in between. Then we need a "have" the the server
> +# does not have, it'll send "ACK %s ready"
> +test_expect_success 'add more commits' '
> +	(
> +	cd shallow &&
> +	for i in $(seq 10); do
> +	git checkout --orphan unrelated$i &&
> +	test_commit unrelated$i >/dev/null &&
> +	git push -q "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" refs/heads/unrelated$i:refs/heads/unrelated$i
> +	git push -q ../clone/.git refs/heads/unrelated$i:refs/heads/unrelated$i
> +	done &&
> +	git checkout master &&
> +	test_commit new &&
> +	git push  "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" master
> +	) &&
> +	(
> +	cd clone &&
> +	git checkout --orphan newnew &&
> +	test_commit new-too &&
> +	git fetch --depth=2
> +	)
> +'
> +
>  stop_httpd
>  test_done

  reply	other threads:[~2014-02-06 19:17 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 15:10 [PATCH 0/6] Fix the shallow deepen bug with no-done Nguyễn Thái Ngọc Duy
2014-02-06 15:10 ` [PATCH 1/6] test: rename http fetch and push test files Nguyễn Thái Ngọc Duy
2014-02-06 19:33   ` Jeff King
2014-02-06 15:10 ` [PATCH 2/6] t5538: fix default http port Nguyễn Thái Ngọc Duy
2014-02-06 19:35   ` Jeff King
2014-02-07 23:47     ` Jeff King
2014-02-08  7:36       ` Duy Nguyen
2014-02-10 14:39         ` Jeff King
2014-02-10 18:23           ` Junio C Hamano
2014-02-10 19:15             ` Jeff King
2014-02-10 19:16               ` Jeff King
2014-02-10 21:29               ` [PATCH] tests: turn on network daemon tests by default Jeff King
2014-02-11 19:51                 ` Junio C Hamano
2014-02-11 20:04                   ` Jeff King
2014-02-11 23:58                     ` Junio C Hamano
2014-02-12 21:47                       ` Jeff King
2014-02-12 22:34                         ` Junio C Hamano
2014-02-13 19:35                           ` Junio C Hamano
2014-02-14  9:58                             ` Jeff King
2014-02-14 16:13                               ` Junio C Hamano
2014-02-12 19:06                     ` Junio C Hamano
2014-02-12 22:12                       ` Jeff King
2014-02-13  1:22                         ` Duy Nguyen
2014-02-13 13:21                           ` [PATCH] t5537: move http tests out to t5539 Nguyễn Thái Ngọc Duy
2014-02-13 20:14                             ` Junio C Hamano
2014-02-06 15:10 ` [PATCH 3/6] pack-protocol.txt: clarify 'obj-id' in the last ACK after 'done' Nguyễn Thái Ngọc Duy
2014-02-06 18:54   ` Junio C Hamano
2014-02-06 15:10 ` [PATCH 4/6] protocol-capabilities.txt: refer multi_ack_detailed back to pack-protocol.txt Nguyễn Thái Ngọc Duy
2014-02-06 15:10 ` [PATCH 5/6] protocol-capabilities.txt: document no-done Nguyễn Thái Ngọc Duy
2014-02-06 18:55   ` Junio C Hamano
2014-02-06 19:40   ` Jeff King
2014-02-06 15:10 ` [PATCH 6/6] fetch-pack: fix deepen shallow over smart http with no-done cap Nguyễn Thái Ngọc Duy
2014-02-06 19:16   ` Junio C Hamano [this message]
2014-02-07  0:52     ` Duy Nguyen
2014-02-06 19:35   ` Eric Sunshine
2014-02-06 19:42   ` Jeff King
2014-02-07 18:01   ` Junio C Hamano
2014-02-07 23:39     ` Duy Nguyen
2014-02-10 18:18       ` Junio C Hamano
2014-02-06 19:31 ` [PATCH 0/6] Fix the shallow deepen bug with no-done Junio C Hamano
2014-02-06 19:44   ` Jeff King
2014-02-07  0:47   ` Duy Nguyen
2014-02-07 19:20     ` Jonathan Nieder
2014-02-07 20:03       ` Junio C Hamano

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=xmqqbnykyrtl.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=pclouds@gmail$(echo .)com \
    --cc=peff@peff$(echo .)net \
    --cc=spearce@spearce$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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