Skip to content

Commit 0ba08c0

Browse files
chriscoolgitster
authored andcommitted
Remove fetch-object.{c,h} in favor of promisor-remote.{c,h}
As fetch_objects() is now used only in promisor-remote.c and should't be used outside it, let's move it into promisor-remote.c, make it static there, and remove fetch-object.{c,h}. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 24c1d35 commit 0ba08c0

File tree

4 files changed

+39
-54
lines changed

4 files changed

+39
-54
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,6 @@ LIB_OBJS += ewah/ewah_io.o
889889
LIB_OBJS += ewah/ewah_rlw.o
890890
LIB_OBJS += exec-cmd.o
891891
LIB_OBJS += fetch-negotiator.o
892-
LIB_OBJS += fetch-object.o
893892
LIB_OBJS += fetch-pack.o
894893
LIB_OBJS += fsck.o
895894
LIB_OBJS += fsmonitor.o

fetch-object.c

Lines changed: 0 additions & 43 deletions
This file was deleted.

fetch-object.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

promisor-remote.c

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,45 @@
22
#include "object-store.h"
33
#include "promisor-remote.h"
44
#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+
}
644

745
static struct promisor_remote *promisors;
846
static struct promisor_remote **promisors_tail = &promisors;

0 commit comments

Comments
 (0)