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

Function upload_pack

upload-pack.c:1401–1470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1399}
1400
1401void upload_pack(const int advertise_refs, const int stateless_rpc,
1402 const int timeout)
1403{
1404 struct packet_reader reader;
1405 struct upload_pack_data data;
1406
1407 upload_pack_data_init(&data);
1408 get_upload_pack_config(the_repository, &data);
1409
1410 data.stateless_rpc = stateless_rpc;
1411 data.timeout = timeout;
1412 if (data.timeout)
1413 data.daemon_mode = 1;
1414
1415 refs_head_ref_namespaced(get_main_ref_store(the_repository),
1416 find_symref, &data.symref);
1417
1418 if (advertise_refs || !data.stateless_rpc) {
1419 reset_timeout(data.timeout);
1420 if (advertise_refs)
1421 data.no_done = 1;
1422 refs_head_ref_namespaced(get_main_ref_store(the_repository),
1423 send_ref, &data);
1424 for_each_namespaced_ref_1(send_ref, &data);
1425 if (!data.sent_capabilities) {
1426 struct reference ref = {
1427 .name = "capabilities^{}",
1428 .oid = null_oid(the_hash_algo),
1429 };
1430
1431 write_v0_ref(&data, &ref, ref.name);
1432 }
1433 /*
1434 * fflush stdout before calling advertise_shallow_grafts because send_ref
1435 * uses stdio.
1436 */
1437 fflush_or_die(stdout);
1438 advertise_shallow_grafts(1);
1439 packet_flush(1);
1440 } else {
1441 refs_head_ref_namespaced(get_main_ref_store(the_repository),
1442 check_ref, &data);
1443 for_each_namespaced_ref_1(check_ref, &data);
1444 }
1445
1446 if (!advertise_refs) {
1447 packet_reader_init(&reader, 0, NULL, 0,
1448 PACKET_READ_CHOMP_NEWLINE |
1449 PACKET_READ_DIE_ON_ERR_PACKET);
1450
1451 receive_needs(&data, &reader);
1452
1453 /*
1454 * An EOF at this exact point in negotiation should be
1455 * acceptable from stateless clients as they will consume the
1456 * shallow list before doing subsequent rpc with haves/etc.
1457 */
1458 if (data.stateless_rpc)

Callers

nothing calls this directly

Calls 15

upload_pack_data_initFunction · 0.85
get_upload_pack_configFunction · 0.85
refs_head_ref_namespacedFunction · 0.85
get_main_ref_storeFunction · 0.85
reset_timeoutFunction · 0.85
null_oidFunction · 0.85
write_v0_refFunction · 0.85
fflush_or_dieFunction · 0.85
advertise_shallow_graftsFunction · 0.85
packet_flushFunction · 0.85
packet_reader_initFunction · 0.85

Tested by

no test coverage detected