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

Function fetch_pack

fetch-pack.c:2168–2223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2166}
2167
2168struct ref *fetch_pack(struct fetch_pack_args *args,
2169 int fd[],
2170 const struct ref *ref,
2171 struct ref **sought, int nr_sought,
2172 struct oid_array *shallow,
2173 struct string_list *pack_lockfiles,
2174 enum protocol_version version)
2175{
2176 struct ref *ref_cpy;
2177 struct shallow_info si;
2178 struct oid_array shallows_scratch = OID_ARRAY_INIT;
2179
2180 fetch_pack_setup();
2181 if (nr_sought)
2182 nr_sought = remove_duplicates_in_refs(sought, nr_sought);
2183
2184 if (version != protocol_v2 && !ref) {
2185 packet_flush(fd[1]);
2186 die(_("no matching remote head"));
2187 }
2188 if (version == protocol_v2) {
2189 if (shallow->nr)
2190 BUG("Protocol V2 does not provide shallows at this point in the fetch");
2191 memset(&si, 0, sizeof(si));
2192 ref_cpy = do_fetch_pack_v2(args, fd, ref, sought, nr_sought,
2193 &shallows_scratch, &si,
2194 pack_lockfiles);
2195 } else {
2196 prepare_shallow_info(&si, shallow);
2197 ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,
2198 &si, pack_lockfiles);
2199 }
2200 odb_reprepare(the_repository->objects);
2201
2202 if (!args->cloning && args->deepen) {
2203 struct check_connected_options opt = CHECK_CONNECTED_INIT;
2204 struct ref *iterator = ref_cpy;
2205 opt.shallow_file = alternate_shallow_file;
2206 if (args->deepen)
2207 opt.is_deepening_fetch = 1;
2208 if (check_connected(iterate_ref_map, &iterator, &opt)) {
2209 error(_("remote did not send all necessary objects"));
2210 free_refs(ref_cpy);
2211 ref_cpy = NULL;
2212 rollback_shallow_file(the_repository, &shallow_lock);
2213 goto cleanup;
2214 }
2215 args->connectivity_checked = 1;
2216 }
2217
2218 update_shallow(args, sought, nr_sought, &si);
2219cleanup:
2220 clear_shallow_info(&si);
2221 oid_array_clear(&shallows_scratch);
2222 return ref_cpy;
2223}
2224
2225static int add_to_object_array(const struct object_id *oid, void *data)

Callers 2

fetch_refs_via_packFunction · 0.85
cmd_fetch_packFunction · 0.85

Calls 15

fetch_pack_setupFunction · 0.85
packet_flushFunction · 0.85
do_fetch_pack_v2Function · 0.85
prepare_shallow_infoFunction · 0.85
do_fetch_packFunction · 0.85
odb_reprepareFunction · 0.85
check_connectedFunction · 0.85
errorFunction · 0.85
free_refsFunction · 0.85
rollback_shallow_fileFunction · 0.85
update_shallowFunction · 0.85

Tested by

no test coverage detected