Subject: [PATCH v3 0/2] Last big GIT_TEST_PROTOCOL_VERSION=2 fix, hopefully

From: Jonathan Tan <[email-masked]>
Date: Tue, 26 Mar 2019 12:31:19 -0700

Peff says in [1]:

> But isn't this line:
> 
> >     + 	if (version == protocol_v2) {
> >     +-		if (shallow && shallow->nr)
> >     ++		if (shallow->nr)
> >       			BUG("Protocol V2 does not provide shallows at this point in the fetch");
> 
> added by patch 1? It's added with "shallow &&" in patch 1, and then
> modified in patch 2.
> 
> I think the "it's never NULL" property is true even before this series,
> right?

Ah...yes you're right. I've updated it here.

Thanks for your review.

[1] https://public-inbox.org/git/[email-masked]/

Jonathan Tan (2):
  fetch-pack: call prepare_shallow_info only if v0
  fetch-pack: respect --no-update-shallow in v2

 commit.h     |  4 ++++
 fetch-pack.c | 51 +++++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 45 insertions(+), 10 deletions(-)

Range-diff against v2:
1:  d2eb101709 ! 1:  64f44a18ad fetch-pack: call prepare_shallow_info only if v0
    @@ -38,7 +38,7 @@
     -	prepare_shallow_info(&si, shallow);
     -	if (version == protocol_v2)
     +	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,
2:  943b1cbc61 ! 2:  3f65698610 fetch-pack: respect --no-update-shallow in v2
    @@ -120,11 +120,6 @@
      	fetch_pack_setup();
      	if (nr_sought)
     @@
    - 		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,
-- 
2.21.0.155.ge902e9bcae.dirty