mirror of
https://github.com/git/git.git
synced 2026-01-10 10:13:33 +00:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
eaa82f8e98
commit
64220dc5f7
@@ -194,6 +194,9 @@ struct packet_reader {
|
||||
|
||||
/* hash algorithm in use */
|
||||
const struct git_hash_algo *hash_algo;
|
||||
|
||||
/* hold temporary sideband message */
|
||||
struct strbuf scratch;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user