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 | ||
8 | void fetch_object(const char *remote_name, const unsigned char *sha1) | |
9 | { | |
10 | struct remote *remote; | |
11 | struct transport *transport; | |
12 | struct ref *ref; | |
8b4c0103 | 13 | int original_fetch_if_missing = fetch_if_missing; |
88e2f9ed | 14 | |
8b4c0103 | 15 | fetch_if_missing = 0; |
88e2f9ed JT |
16 | remote = remote_get(remote_name); |
17 | if (!remote->url[0]) | |
18 | die(_("Remote with no URL")); | |
19 | transport = transport_get(remote, remote->url[0]); | |
20 | ||
21 | ref = alloc_ref(sha1_to_hex(sha1)); | |
22 | hashcpy(ref->old_oid.hash, sha1); | |
23 | transport_set_option(transport, TRANS_OPT_FROM_PROMISOR, "1"); | |
24 | transport_set_option(transport, TRANS_OPT_NO_DEPENDENTS, "1"); | |
25 | transport_fetch_refs(transport, ref); | |
8b4c0103 | 26 | fetch_if_missing = original_fetch_if_missing; |
88e2f9ed | 27 | } |