Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Royce Remer <royceremer@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] [PATCH] Fix upload_pack_v2 response ordering for shallow fetch when server has uploadpack.allowRefInWant=true
Date: Tue, 15 Sep 2026 13:19:01 -0700	[thread overview]
Message-ID: <xmqq1pauz2ru.fsf@gitster.g> (raw)
In-Reply-To: <xmqqa4piz3pn.fsf@gitster.g> (Junio C. Hamano's message of "Tue, 15 Sep 2026 12:58:44 -0700")

Junio C Hamano <gitster@pobox.com> writes:

>> diff --git a/upload-pack.c b/upload-pack.c
>> index a52856d869..a70d237ad3 100644
>> --- a/upload-pack.c
>> +++ b/upload-pack.c
>> @@ -1812,8 +1812,8 @@ int upload_pack_v2(struct repository *r, struct packet_reader *request)
>>  				state = UPLOAD_DONE;
>>  			break;
>>  		case UPLOAD_SEND_PACK:
>> -			send_wanted_ref_info(&data);
>>  			send_shallow_info(&data);
>> +			send_wanted_ref_info(&data);
>>  
>>  			if (data.uri_protocols.nr) {
>>  				create_pack_file(&data, &data.uri_protocols);

I am merely guessing what your reasoning is, but is this meant to
match this part of the code on the other side of the connection?

		case FETCH_GET_PACK:
			trace2_region_leave("fetch-pack",
					    "negotiation_v2",
					    the_repository);
			trace2_data_intmax("negotiation_v2", the_repository,
					   "total_rounds", negotiation_round);
			/* Check for shallow-info section */
			if (process_section_header(&reader, "shallow-info", 1))
				receive_shallow_info(args, &reader, shallows, si);

			if (process_section_header(&reader, "wanted-refs", 1))
				receive_wanted_refs(&reader, sought, nr_sought);


These process_section_header() calls are made with the peek bit set,
signaling that it is OK if the packet we are about to receive is not
the one that is being checked, so what may happen is

 - upload-pack gives wanted-ref info and then shallow-info.

 - fetch-pack sees wanted-refs, notices that it is not shallow-info,
   ignores it, and the next process_section_header() call does
   notice it is wanted-refs and processes it.

But then, who consumes the shallow-info?  Does fetch-pack notices
shallow-info that it did not expect to see and crashes?  If so, that
is a very noteworthy thing to say in the proposed log message.  If
it does not crash and goes on but without utilizing what was carried
in the shallow-info packet, the resulting behaviour of fetch-pack
would be different from what we would expect, and if that is the
case, that difference is a noteworthy thing to decribe in the
proposed log message.

Thanks.


  reply	other threads:[~2026-09-15 20:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 19:30 [PATCH] [PATCH] Fix upload_pack_v2 response ordering for shallow fetch when server has uploadpack.allowRefInWant=true Royce Remer
2026-09-15 19:58 ` Junio C Hamano
2026-09-15 20:19   ` Junio C Hamano [this message]
2026-09-15 21:03     ` Royce Gerard Remer
2026-09-16 16:43       ` Junio C Hamano
2026-09-16 20:32 ` [PATCH v2] upload-pack: swap wanted-ref/shallow-info responses Royce Remer
2026-09-17  6:20   ` 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=xmqq1pauz2ru.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=royceremer@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