]>
Commit | Line | Data |
---|---|---|
88e2f9ed JT |
1 | #include "cache.h" |
2 | #include "packfile.h" | |
3 | #include "pkt-line.h" | |
4 | #include "strbuf.h" | |
5 | #include "transport.h" | |
6 | #include "fetch-object.h" | |
7 | ||
c0c578b3 | 8 | static void fetch_refs(const char *remote_name, struct ref *ref) |
88e2f9ed JT |
9 | { |
10 | struct remote *remote; | |
11 | struct transport *transport; | |
8b4c0103 | 12 | int original_fetch_if_missing = fetch_if_missing; |
88e2f9ed | 13 | |
8b4c0103 | 14 | fetch_if_missing = 0; |
88e2f9ed JT |
15 | remote = remote_get(remote_name); |
16 | if (!remote->url[0]) | |
17 | die(_("Remote with no URL")); | |
18 | transport = transport_get(remote, remote->url[0]); | |
19 | ||
88e2f9ed JT |
20 | transport_set_option(transport, TRANS_OPT_FROM_PROMISOR, "1"); |
21 | transport_set_option(transport, TRANS_OPT_NO_DEPENDENTS, "1"); | |
e2842b39 | 22 | transport_fetch_refs(transport, ref); |
8b4c0103 | 23 | fetch_if_missing = original_fetch_if_missing; |
88e2f9ed | 24 | } |
c0c578b3 | 25 | |
8708ca09 JT |
26 | void fetch_objects(const char *remote_name, const struct object_id *oids, |
27 | int oid_nr) | |
c0c578b3 JT |
28 | { |
29 | struct ref *ref = NULL; | |
30 | int i; | |
31 | ||
8708ca09 JT |
32 | for (i = 0; i < oid_nr; i++) { |
33 | struct ref *new_ref = alloc_ref(oid_to_hex(&oids[i])); | |
34 | oidcpy(&new_ref->old_oid, &oids[i]); | |
e6830201 | 35 | new_ref->exact_oid = 1; |
c0c578b3 JT |
36 | new_ref->next = ref; |
37 | ref = new_ref; | |
38 | } | |
39 | fetch_refs(remote_name, ref); | |
40 | } |