MCPcopy Index your code
hub / github.com/git/git / send_fetch_request

Function send_fetch_request

fetch-pack.c:1411–1489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1409}
1410
1411static 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 */

Callers 1

do_fetch_pack_v2Function · 0.85

Calls 15

packet_buf_writeFunction · 0.85
server_supports_featureFunction · 0.85
add_shallow_requestsFunction · 0.85
is_repository_shallowFunction · 0.85
send_filterFunction · 0.85
strbuf_addchFunction · 0.85
strbuf_addstrFunction · 0.85
strbuf_releaseFunction · 0.85
add_wantsFunction · 0.85
add_commonFunction · 0.85
add_havesFunction · 0.85

Tested by

no test coverage detected