Merge branch 'jv/pkt-line-batch'

Reduce number of write(2) system calls while sending the
ref advertisement.

* jv/pkt-line-batch:
  upload-pack: use stdio in send_ref callbacks
  pkt-line: add stdio packet write functions
This commit is contained in:
Junio C Hamano
2021-09-20 15:20:40 -07:00
6 changed files with 72 additions and 5 deletions

View File

@@ -107,7 +107,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
}
strbuf_addch(&data->buf, '\n');
packet_write(1, data->buf.buf, data->buf.len);
packet_fwrite(stdout, data->buf.buf, data->buf.len);
return 0;
}
@@ -173,7 +173,7 @@ int ls_refs(struct repository *r, struct strvec *keys,
strvec_push(&data.prefixes, "");
for_each_fullref_in_prefixes(get_git_namespace(), data.prefixes.v,
send_ref, &data, 0);
packet_flush(1);
packet_fflush(stdout);
strvec_clear(&data.prefixes);
strbuf_release(&data.buf);
return 0;