MCPcopy Create free account
hub / github.com/git/git / upload_pack_v2

Function upload_pack_v2

upload-pack.c:1770–1833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1768};
1769
1770int upload_pack_v2(struct repository *r, struct packet_reader *request)
1771{
1772 enum upload_state state = UPLOAD_PROCESS_ARGS;
1773 struct upload_pack_data data;
1774
1775 clear_object_flags(the_repository, ALL_FLAGS);
1776
1777 upload_pack_data_init(&data);
1778 data.use_sideband = LARGE_PACKET_MAX;
1779 get_upload_pack_config(r, &data);
1780
1781 while (state != UPLOAD_DONE) {
1782 switch (state) {
1783 case UPLOAD_PROCESS_ARGS:
1784 process_args(request, &data);
1785
1786 if (!data.want_obj.nr && !data.wait_for_done) {
1787 /*
1788 * Request didn't contain any 'want' lines (and
1789 * the request does not contain
1790 * "wait-for-done", in which it is reasonable
1791 * to just send 'have's without 'want's); guess
1792 * they didn't want anything.
1793 */
1794 state = UPLOAD_DONE;
1795 } else if (data.seen_haves) {
1796 /*
1797 * Request had 'have' lines, so lets ACK them.
1798 */
1799 state = UPLOAD_SEND_ACKS;
1800 } else {
1801 /*
1802 * Request had 'want's but no 'have's so we can
1803 * immediately go to construct and send a pack.
1804 */
1805 state = UPLOAD_SEND_PACK;
1806 }
1807 break;
1808 case UPLOAD_SEND_ACKS:
1809 if (process_haves_and_send_acks(&data))
1810 state = UPLOAD_SEND_PACK;
1811 else
1812 state = UPLOAD_DONE;
1813 break;
1814 case UPLOAD_SEND_PACK:
1815 send_wanted_ref_info(&data);
1816 send_shallow_info(&data);
1817
1818 if (data.uri_protocols.nr) {
1819 create_pack_file(&data, &data.uri_protocols);
1820 } else {
1821 packet_writer_write(&data.writer, "packfile\n");
1822 create_pack_file(&data, NULL);
1823 }
1824 state = UPLOAD_DONE;
1825 break;
1826 case UPLOAD_DONE:
1827 continue;

Callers

nothing calls this directly

Calls 10

clear_object_flagsFunction · 0.85
upload_pack_data_initFunction · 0.85
get_upload_pack_configFunction · 0.85
process_argsFunction · 0.85
send_wanted_ref_infoFunction · 0.85
send_shallow_infoFunction · 0.85
create_pack_fileFunction · 0.85
packet_writer_writeFunction · 0.85
upload_pack_data_clearFunction · 0.85

Tested by

no test coverage detected