| 1409 | } |
| 1410 | |
| 1411 | static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out, |
| 1412 | struct fetch_pack_args *args, |
| 1413 | const struct ref *wants, struct oidset *common, |
| 1414 | int *haves_to_send, int *in_vain, |
| 1415 | int sideband_all, int seen_ack, |
| 1416 | struct oidset *negotiation_include_oids) |
| 1417 | { |
| 1418 | int haves_added; |
| 1419 | int done_sent = 0; |
| 1420 | struct strbuf req_buf = STRBUF_INIT; |
| 1421 | |
| 1422 | write_fetch_command_and_capabilities(&req_buf, args->server_options); |
| 1423 | |
| 1424 | if (args->use_thin_pack) |
| 1425 | packet_buf_write(&req_buf, "thin-pack"); |
| 1426 | if (args->no_progress) |
| 1427 | packet_buf_write(&req_buf, "no-progress"); |
| 1428 | if (args->include_tag) |
| 1429 | packet_buf_write(&req_buf, "include-tag"); |
| 1430 | if (prefer_ofs_delta) |
| 1431 | packet_buf_write(&req_buf, "ofs-delta"); |
| 1432 | if (sideband_all) |
| 1433 | packet_buf_write(&req_buf, "sideband-all"); |
| 1434 | |
| 1435 | /* Add shallow-info and deepen request */ |
| 1436 | if (server_supports_feature("fetch", "shallow", 0)) |
| 1437 | add_shallow_requests(&req_buf, args); |
| 1438 | else if (is_repository_shallow(the_repository) || args->deepen) |
| 1439 | die(_("Server does not support shallow requests")); |
| 1440 | |
| 1441 | /* Add filter */ |
| 1442 | send_filter(args, &req_buf, |
| 1443 | server_supports_feature("fetch", "filter", 0)); |
| 1444 | |
| 1445 | if (server_supports_feature("fetch", "packfile-uris", 0)) { |
| 1446 | int i; |
| 1447 | struct strbuf to_send = STRBUF_INIT; |
| 1448 | |
| 1449 | for (i = 0; i < uri_protocols.nr; i++) { |
| 1450 | const char *s = uri_protocols.items[i].string; |
| 1451 | |
| 1452 | if (!strcmp(s, "https") || !strcmp(s, "http")) { |
| 1453 | if (to_send.len) |
| 1454 | strbuf_addch(&to_send, ','); |
| 1455 | strbuf_addstr(&to_send, s); |
| 1456 | } |
| 1457 | } |
| 1458 | if (to_send.len) { |
| 1459 | packet_buf_write(&req_buf, "packfile-uris %s", |
| 1460 | to_send.buf); |
| 1461 | strbuf_release(&to_send); |
| 1462 | } |
| 1463 | } |
| 1464 | |
| 1465 | /* add wants */ |
| 1466 | add_wants(wants, &req_buf); |
| 1467 | |
| 1468 | /* Add all of the common commits we've found in previous rounds */ |
no test coverage detected