commit - 1b3e8e8674ebd24834b549a70d90487307d0f3bf
commit + 2ff9f0818d453fcbfcf4843b368604f277cf4458
blob - 85ee3e8503a054b2d587e80262d305695c1c8449
blob + b8131d3c9afbbd434818c6c64743b9be8d7edf13
--- lib/serve.c
+++ lib/serve.c
}
static const struct got_error *
-send_zero_refs(int outfd, int chattygot)
+send_zero_refs(int outfd, int client_is_reading, int chattygot)
{
const struct got_error *err = NULL;
char buf[GOT_PKT_MAX];
if (len >= sizeof(buf))
return got_error(GOT_ERR_NO_SPACE);
- err = got_gitproto_append_capabilities(&capalen, buf, len,
- sizeof(buf), read_capabilities, nitems(read_capabilities));
- if (err)
- return err;
+ if (client_is_reading) {
+ err = got_gitproto_append_capabilities(&capalen, buf, len,
+ sizeof(buf), read_capabilities, nitems(read_capabilities));
+ if (err)
+ return err;
+ } else {
+ err = got_gitproto_append_capabilities(&capalen, buf, len,
+ sizeof(buf), write_capabilities,
+ nitems(write_capabilities));
+ if (err)
+ return err;
+ }
return got_pkt_writepkt(outfd, buf, len + capalen, chattygot);
}
nrefs = ireflist.nrefs;
have_nrefs = 1;
if (nrefs == 0)
- err = send_zero_refs(outfd, chattygot);
+ err = send_zero_refs(outfd, client_is_reading,
+ chattygot);
break;
case GOTD_IMSG_REF:
if (!have_nrefs || nrefs == 0) {