Skip to content

Commit 8c2efa5

Browse files
dschogitster
authored andcommitted
pkt-line: add options argument to read_packetized_to_strbuf()
Update the calling sequence of `read_packetized_to_strbuf()` to take an options argument and not assume a fixed set of options. Update the only existing caller accordingly to explicitly pass the formerly-assumed flags. The `read_packetized_to_strbuf()` function calls `packet_read()` with a fixed set of assumed options (`PACKET_READ_GENTLE_ON_EOF`). This assumption has been fine for the single existing caller `apply_multi_file_filter()` in `convert.c`. In a later commit we would like to add other callers to `read_packetized_to_strbuf()` that need a different set of options. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Jeff Hostetler <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c4ba579 commit 8c2efa5

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

convert.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,8 @@ static int apply_multi_file_filter(const char *path, const char *src, size_t len
907907
if (err)
908908
goto done;
909909

910-
err = read_packetized_to_strbuf(process->out, &nbuf) < 0;
910+
err = read_packetized_to_strbuf(process->out, &nbuf,
911+
PACKET_READ_GENTLE_ON_EOF) < 0;
911912
if (err)
912913
goto done;
913914

pkt-line.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ char *packet_read_line_buf(char **src, size_t *src_len, int *dst_len)
444444
return packet_read_line_generic(-1, src, src_len, dst_len);
445445
}
446446

447-
ssize_t read_packetized_to_strbuf(int fd_in, struct strbuf *sb_out)
447+
ssize_t read_packetized_to_strbuf(int fd_in, struct strbuf *sb_out, int options)
448448
{
449449
int packet_len;
450450

@@ -460,7 +460,7 @@ ssize_t read_packetized_to_strbuf(int fd_in, struct strbuf *sb_out)
460460
* that there is already room for the extra byte.
461461
*/
462462
sb_out->buf + sb_out->len, LARGE_PACKET_DATA_MAX+1,
463-
PACKET_READ_GENTLE_ON_EOF);
463+
options);
464464
if (packet_len <= 0)
465465
break;
466466
sb_out->len += packet_len;

pkt-line.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ char *packet_read_line_buf(char **src_buf, size_t *src_len, int *size);
136136
/*
137137
* Reads a stream of variable sized packets until a flush packet is detected.
138138
*/
139-
ssize_t read_packetized_to_strbuf(int fd_in, struct strbuf *sb_out);
139+
ssize_t read_packetized_to_strbuf(int fd_in, struct strbuf *sb_out, int options);
140140

141141
/*
142142
* Receive multiplexed output stream over git native protocol.

0 commit comments

Comments
 (0)