| 1342 | } |
| 1343 | |
| 1344 | static int add_haves(struct fetch_negotiator *negotiator, |
| 1345 | struct strbuf *req_buf, |
| 1346 | int *haves_to_send, |
| 1347 | struct oidset *negotiation_include_oids) |
| 1348 | { |
| 1349 | int haves_added = 0; |
| 1350 | const struct object_id *oid; |
| 1351 | |
| 1352 | /* Send unconditional haves from --negotiation-include */ |
| 1353 | if (negotiation_include_oids) { |
| 1354 | struct oidset_iter iter; |
| 1355 | oidset_iter_init(negotiation_include_oids, &iter); |
| 1356 | |
| 1357 | while ((oid = oidset_iter_next(&iter))) { |
| 1358 | struct commit *commit = lookup_commit(the_repository, oid); |
| 1359 | if (commit) { |
| 1360 | packet_buf_write(req_buf, "have %s\n", |
| 1361 | oid_to_hex(oid)); |
| 1362 | negotiator->have_sent(negotiator, commit); |
| 1363 | } |
| 1364 | } |
| 1365 | } |
| 1366 | |
| 1367 | while ((oid = negotiator->next(negotiator))) { |
| 1368 | packet_buf_write(req_buf, "have %s\n", oid_to_hex(oid)); |
| 1369 | if (++haves_added >= *haves_to_send) |
| 1370 | break; |
| 1371 | } |
| 1372 | |
| 1373 | /* Increase haves to send on next round */ |
| 1374 | *haves_to_send = next_flush(1, *haves_to_send); |
| 1375 | |
| 1376 | return haves_added; |
| 1377 | } |
| 1378 | |
| 1379 | static void write_fetch_command_and_capabilities(struct strbuf *req_buf, |
| 1380 | const struct string_list *server_options) |
no test coverage detected