]> git.ipfire.org Git - thirdparty/git.git/blobdiff - pkt-line.c
Merge branch 'jc/ci-github-set-env'
[thirdparty/git.git] / pkt-line.c
index 8f9bc68ee28ef46b2cd221a46a2049bf8a633511..d633005ef746ad1eb7445cb75401e0c3f55a2312 100644 (file)
@@ -461,9 +461,11 @@ int recv_sideband(const char *me, int in_stream, int out)
        enum sideband_type sideband_type;
 
        while (1) {
-               len = packet_read(in_stream, NULL, NULL, buf, LARGE_PACKET_MAX,
-                                 0);
-               if (!demultiplex_sideband(me, buf, len, 0, &scratch,
+               int status = packet_read_with_status(in_stream, NULL, NULL,
+                                                    buf, LARGE_PACKET_MAX,
+                                                    &len,
+                                                    PACKET_READ_GENTLE_ON_EOF);
+               if (!demultiplex_sideband(me, status, buf, len, 0, &scratch,
                                          &sideband_type))
                        continue;
                switch (sideband_type) {
@@ -471,6 +473,9 @@ int recv_sideband(const char *me, int in_stream, int out)
                        write_or_die(out, buf + 1, len - 1);
                        break;
                default: /* errors: message already written */
+                       if (scratch.len > 0)
+                               BUG("unhandled incomplete sideband: '%s'",
+                                   scratch.buf);
                        return sideband_type;
                }
        }
@@ -490,6 +495,7 @@ void packet_reader_init(struct packet_reader *reader, int fd,
        reader->buffer_size = sizeof(packet_buffer);
        reader->options = options;
        reader->me = "git";
+       reader->hash_algo = &hash_algos[GIT_HASH_SHA1];
 }
 
 enum packet_read_status packet_reader_read(struct packet_reader *reader)
@@ -516,9 +522,9 @@ enum packet_read_status packet_reader_read(struct packet_reader *reader)
                                                         reader->options);
                if (!reader->use_sideband)
                        break;
-               if (demultiplex_sideband(reader->me, reader->buffer,
-                                        reader->pktlen, 1, &scratch,
-                                        &sideband_type))
+               if (demultiplex_sideband(reader->me, reader->status,
+                                        reader->buffer, reader->pktlen, 1,
+                                        &scratch, &sideband_type))
                        break;
        }