git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: git@vger.kernel.org, pclouds@gmail.com
Subject: Re: [PATCH v2 2/2] fetch-pack: respect --no-update-shallow in v2
Date: Tue, 26 Mar 2019 14:23:00 -0400	[thread overview]
Message-ID: <20190326182300.GC24105@sigill.intra.peff.net> (raw)
In-Reply-To: <943b1cbc61dbcc498a9e34d7d39dc8617cb99195.1553622679.git.jonathantanmy@google.com>

On Tue, Mar 26, 2019 at 10:53:26AM -0700, Jonathan Tan wrote:

> @@ -1625,6 +1649,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
>  {
>  	struct ref *ref_cpy;
>  	struct shallow_info si;
> +	struct oid_array shallows_scratch = OID_ARRAY_INIT;
>  
>  	fetch_pack_setup();
>  	if (nr_sought)
> @@ -1649,10 +1674,11 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
>  		die(_("no matching remote head"));
>  	}
>  	if (version == protocol_v2) {
> -		if (shallow && shallow->nr)
> +		if (shallow->nr)
>  			BUG("Protocol V2 does not provide shallows at this point in the fetch");
>  		memset(&si, 0, sizeof(si));
>  		ref_cpy = do_fetch_pack_v2(args, fd, ref, sought, nr_sought,
> +					   &shallows_scratch, &si,
>  					   pack_lockfile);
>  	} else {
>  		prepare_shallow_info(&si, shallow);
> @@ -1680,6 +1706,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
>  	update_shallow(args, sought, nr_sought, &si);
>  cleanup:
>  	clear_shallow_info(&si);
> +	oid_array_clear(&shallows_scratch);
>  	return ref_cpy;
>  }

Yeah, this is much clearer than what I posted earlier. Thanks for
thinking it through.

The patches look good to me, modulo the timing of the NULL thing I
mentioned elsewhere.

-Peff

  reply	other threads:[~2019-03-26 18:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25 20:43 [PATCH 0/2] Last big GIT_TEST_PROTOCOL_VERSION=2 fix, hopefully Jonathan Tan
2019-03-25 20:43 ` [PATCH 1/2] fetch-pack: call prepare_shallow_info only if v0 Jonathan Tan
2019-03-26  5:00   ` Jeff King
2019-03-25 20:43 ` [PATCH 2/2] fetch-pack: respect --no-update-shallow in v2 Jonathan Tan
2019-03-26  5:20   ` Jeff King
2019-03-26 10:14     ` Duy Nguyen
2019-03-26 15:18       ` Jeff King
2019-03-26 15:39         ` Duy Nguyen
2019-03-26 17:37     ` Jonathan Tan
2019-03-26 18:18       ` Jeff King
2019-03-26 17:53 ` [PATCH v2 0/2] Last big GIT_TEST_PROTOCOL_VERSION=2 fix, hopefully Jonathan Tan
2019-03-26 17:53   ` [PATCH v2 1/2] fetch-pack: call prepare_shallow_info only if v0 Jonathan Tan
2019-03-26 17:53   ` [PATCH v2 2/2] fetch-pack: respect --no-update-shallow in v2 Jonathan Tan
2019-03-26 18:23     ` Jeff King [this message]
2019-03-26 18:20   ` [PATCH v2 0/2] Last big GIT_TEST_PROTOCOL_VERSION=2 fix, hopefully Jeff King
2019-03-26 19:31 ` [PATCH v3 " Jonathan Tan
2019-03-26 19:31   ` [PATCH v3 1/2] fetch-pack: call prepare_shallow_info only if v0 Jonathan Tan
2019-03-26 19:31   ` [PATCH v3 2/2] fetch-pack: respect --no-update-shallow in v2 Jonathan Tan

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=20190326182300.GC24105@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    --cc=pclouds@gmail.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.
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).