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, arturas@uber.com
Subject: Re: [PATCH] upload-pack: clear flags before each v2 request
Date: Thu, 18 Oct 2018 14:16:22 +0900	[thread overview]
Message-ID: <xmqq5zxzvnq1.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20181016215850.47821-1-jonathantanmy@google.com> (Jonathan Tan's message of "Tue, 16 Oct 2018 14:58:50 -0700")

Jonathan Tan <jonathantanmy@google.com> writes:

> Suppose a server has the following commit graph:
>
>  A   B
>   \ /
>    O
>
> We create a client by cloning A from the server with depth 1, and add
> many commits to it (so that future fetches span multiple requests due to
> lengthy negotiation). If it then fetches B using protocol v2, the fetch
> spanning multiple requests, the resulting packfile does not contain O
> even though the client did report that A is shallow.

Hmph, what if commit O had a long history behind it?  

Should fetching of B result in fetching the whole history?  Would we
notice that now all of A's parents are available locally and declare
that the repository is no longer shallow?

I am trying to figure out if "does not contain O when we fetch B,
even though we earlier fetched A shallowly, excluding its parents"
is unconditionally a bad thing.

The change to the code itself sort-of makes sense (I say sort-of
because I didn't carefully look at the callers to see if they mind
getting all these flags cleared, but the ones that are cleared are
the ones that are involved mostly in the negotiation and shold be
OK).

> diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
> index 88a886975d..70b88385ba 100755
> --- a/t/t5702-protocol-v2.sh
> +++ b/t/t5702-protocol-v2.sh
> @@ -429,6 +429,31 @@ test_expect_success 'fetch supports include-tag and tag following' '
>  	git -C client cat-file -e $(git -C client rev-parse annotated_tag)
>  '
>  
> +test_expect_success 'upload-pack respects client shallows' '
> +	rm -rf server client trace &&
> +
> +	git init server &&
> +	test_commit -C server base &&
> +	test_commit -C server client_has &&
> +
> +	git clone --depth=1 "file://$(pwd)/server" client &&
> +
> +	# Add extra commits to the client so that the whole fetch takes more
> +	# than 1 request (due to negotiation)
> +	for i in $(seq 1 32)

Use test_seq instead, or you'll get hit by test-lint?

Applied on 'master' or 'maint', this new test does not pass even
with s/seq/test_&/, so there may be something else wrong with it,
though.

  parent reply	other threads:[~2018-10-18  5:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 21:58 [PATCH] upload-pack: clear flags before each v2 request Jonathan Tan
2018-10-17 12:05 ` Arturas Moskvinas
2018-10-18  5:16 ` Junio C Hamano [this message]
2018-10-18 20:43 ` [PATCH v2 0/3] Clear " Jonathan Tan
2018-10-18 20:43   ` [PATCH v2 1/3] upload-pack: make have_obj not global Jonathan Tan
2018-10-18 20:43   ` [PATCH v2 2/3] upload-pack: make want_obj " Jonathan Tan
2018-10-18 20:43   ` [PATCH v2 3/3] upload-pack: clear flags before each v2 request Jonathan Tan
2018-10-19  3:19   ` [PATCH v2 0/3] Clear " 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

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