|
2 | 2 | #include "object-store.h"
|
3 | 3 | #include "promisor-remote.h"
|
4 | 4 | #include "config.h"
|
5 |
| -#include "fetch-object.h" |
| 5 | +#include "transport.h" |
| 6 | + |
| 7 | +static int fetch_refs(const char *remote_name, struct ref *ref) |
| 8 | +{ |
| 9 | + struct remote *remote; |
| 10 | + struct transport *transport; |
| 11 | + int original_fetch_if_missing = fetch_if_missing; |
| 12 | + int res; |
| 13 | + |
| 14 | + fetch_if_missing = 0; |
| 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 | + |
| 20 | + transport_set_option(transport, TRANS_OPT_FROM_PROMISOR, "1"); |
| 21 | + transport_set_option(transport, TRANS_OPT_NO_DEPENDENTS, "1"); |
| 22 | + res = transport_fetch_refs(transport, ref); |
| 23 | + fetch_if_missing = original_fetch_if_missing; |
| 24 | + |
| 25 | + return res; |
| 26 | +} |
| 27 | + |
| 28 | +static int fetch_objects(const char *remote_name, |
| 29 | + const struct object_id *oids, |
| 30 | + int oid_nr) |
| 31 | +{ |
| 32 | + struct ref *ref = NULL; |
| 33 | + int i; |
| 34 | + |
| 35 | + for (i = 0; i < oid_nr; i++) { |
| 36 | + struct ref *new_ref = alloc_ref(oid_to_hex(&oids[i])); |
| 37 | + oidcpy(&new_ref->old_oid, &oids[i]); |
| 38 | + new_ref->exact_oid = 1; |
| 39 | + new_ref->next = ref; |
| 40 | + ref = new_ref; |
| 41 | + } |
| 42 | + return fetch_refs(remote_name, ref); |
| 43 | +} |
6 | 44 |
|
7 | 45 | static struct promisor_remote *promisors;
|
8 | 46 | static struct promisor_remote **promisors_tail = &promisors;
|
|
0 commit comments