{fetch,upload}-pack: sideband v2 fetch response
Currently, a response to a fetch request has sideband support only while the packfile is being sent, meaning that the server cannot send notices until the start of the packfile. Extend sideband support in protocol v2 fetch responses to the whole response. upload-pack will advertise it if the uploadpack.allowsidebandall configuration variable is set, and fetch-pack will automatically request it if advertised. If the sideband is to be used throughout the whole response, upload-pack will use it to send errors instead of prefixing a PKT-LINE payload with "ERR ". This will be tested in a subsequent patch. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
fbd76cd450
commit
0bbc0bc574
12
fetch-pack.c
12
fetch-pack.c
@ -1090,7 +1090,8 @@ static int add_haves(struct fetch_negotiator *negotiator,
|
||||
static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
|
||||
const struct fetch_pack_args *args,
|
||||
const struct ref *wants, struct oidset *common,
|
||||
int *haves_to_send, int *in_vain)
|
||||
int *haves_to_send, int *in_vain,
|
||||
int sideband_all)
|
||||
{
|
||||
int ret = 0;
|
||||
struct strbuf req_buf = STRBUF_INIT;
|
||||
@ -1116,6 +1117,8 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
|
||||
packet_buf_write(&req_buf, "include-tag");
|
||||
if (prefer_ofs_delta)
|
||||
packet_buf_write(&req_buf, "ofs-delta");
|
||||
if (sideband_all)
|
||||
packet_buf_write(&req_buf, "sideband-all");
|
||||
|
||||
/* Add shallow-info and deepen request */
|
||||
if (server_supports_feature("fetch", "shallow", 0))
|
||||
@ -1324,6 +1327,10 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
|
||||
packet_reader_init(&reader, fd[0], NULL, 0,
|
||||
PACKET_READ_CHOMP_NEWLINE |
|
||||
PACKET_READ_DIE_ON_ERR_PACKET);
|
||||
if (server_supports_feature("fetch", "sideband-all", 0)) {
|
||||
reader.use_sideband = 1;
|
||||
reader.me = "fetch-pack";
|
||||
}
|
||||
|
||||
while (state != FETCH_DONE) {
|
||||
switch (state) {
|
||||
@ -1357,7 +1364,8 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
|
||||
case FETCH_SEND_REQUEST:
|
||||
if (send_fetch_request(&negotiator, fd[1], args, ref,
|
||||
&common,
|
||||
&haves_to_send, &in_vain))
|
||||
&haves_to_send, &in_vain,
|
||||
reader.use_sideband))
|
||||
state = FETCH_GET_PACK;
|
||||
else
|
||||
state = FETCH_PROCESS_ACKS;
|
||||
|
||||
Reference in New Issue
Block a user