]> git.ipfire.org Git - thirdparty/git.git/blobdiff - upload-pack.c
Merge branch 'en/merge-ort-api-null-impl'
[thirdparty/git.git] / upload-pack.c
index 3b858eb457e557592dada080f95f3fe7e218b24b..5dc8e1f844222b18ede6c3734a8ed5953ea59dd1 100644 (file)
@@ -1344,7 +1344,18 @@ void upload_pack(struct upload_pack_options *options)
                                   PACKET_READ_DIE_ON_ERR_PACKET);
 
                receive_needs(&data, &reader);
-               if (data.want_obj.nr) {
+
+               /*
+                * An EOF at this exact point in negotiation should be
+                * acceptable from stateless clients as they will consume the
+                * shallow list before doing subsequent rpc with haves/etc.
+                */
+               if (data.stateless_rpc)
+                       reader.options |= PACKET_READ_GENTLE_ON_EOF;
+
+               if (data.want_obj.nr &&
+                   packet_reader_peek(&reader) != PACKET_READ_EOF) {
+                       reader.options &= ~PACKET_READ_GENTLE_ON_EOF;
                        get_common_commits(&data, &reader);
                        create_pack_file(&data, NULL);
                }