diff options
author | Jiang Xin <zhiyou.jx@alibaba-inc.com> | 2023-12-17 17:41:37 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-12-19 00:24:37 +0300 |
commit | 64220dc5f7450d8eca471fa484965b1dcddc2827 (patch) | |
tree | 2b8c592b39a440f65f6ccc9cd44f00573cd61478 /t | |
parent | eaa82f8e983199080369c44869ceac1e403f81fc (diff) |
pkt-line: memorize sideband fragment in reader
When we turn on the "use_sideband" field of the packet_reader,
"packet_reader_read()" will call the function "demultiplex_sideband()"
to parse and consume sideband messages. Sideband fragment which does not
end with "\r" or "\n" will be saved in the sixth parameter "scratch"
and it can be reused and be concatenated when parsing another sideband
message.
In "packet_reader_read()" function, the local variable "scratch" can
only be reused by subsequent sideband messages. But if there is a
payload message between two sideband fragments, the first fragment
which is saved in the local variable "scratch" will be lost.
To solve this problem, we can add a new field "scratch" in
packet_reader to memorize the sideband fragment across different calls
of "packet_reader_read()".
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t0070-fundamental.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh index 297a7f772e..275edbf6e7 100755 --- a/t/t0070-fundamental.sh +++ b/t/t0070-fundamental.sh @@ -81,7 +81,7 @@ test_expect_success 'unpack-sideband: --chomp-newline (default)' ' test_cmp expect-err err ' -test_expect_failure 'unpack-sideband: packet_reader_read() consumes sideband, no chomp payload' ' +test_expect_success 'unpack-sideband: packet_reader_read() consumes sideband, no chomp payload' ' test_when_finished "rm -f expect-out expect-err" && test-tool pkt-line send-split-sideband >split-sideband && test-tool pkt-line unpack-sideband \ |