summaryrefslogtreecommitdiff
path: root/streaming.c
diff options
context:
space:
mode:
Diffstat (limited to 'streaming.c')
-rw-r--r--streaming.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/streaming.c b/streaming.c
index 6d6512e2e0..00ad649ae3 100644
--- a/streaming.c
+++ b/streaming.c
@@ -10,7 +10,7 @@
#include "streaming.h"
#include "repository.h"
#include "object-file.h"
-#include "object-store.h"
+#include "odb.h"
#include "replace-object.h"
#include "packfile.h"
@@ -44,7 +44,7 @@ struct git_istream {
union {
struct {
- char *buf; /* from oid_object_info_extended() */
+ char *buf; /* from odb_read_object_info_extended() */
unsigned long read_ptr;
} incore;
@@ -230,12 +230,21 @@ static int open_istream_loose(struct git_istream *st, struct repository *r,
enum object_type *type)
{
struct object_info oi = OBJECT_INFO_INIT;
+ struct odb_source *source;
+
oi.sizep = &st->size;
oi.typep = type;
- st->u.loose.mapped = map_loose_object(r, oid, &st->u.loose.mapsize);
+ odb_prepare_alternates(r->objects);
+ for (source = r->objects->sources; source; source = source->next) {
+ st->u.loose.mapped = odb_source_loose_map_object(source, oid,
+ &st->u.loose.mapsize);
+ if (st->u.loose.mapped)
+ break;
+ }
if (!st->u.loose.mapped)
return -1;
+
switch (unpack_loose_header(&st->z, st->u.loose.mapped,
st->u.loose.mapsize, st->u.loose.hdr,
sizeof(st->u.loose.hdr))) {
@@ -403,8 +412,8 @@ static int open_istream_incore(struct git_istream *st, struct repository *r,
oi.typep = type;
oi.sizep = &st->size;
oi.contentp = (void **)&st->u.incore.buf;
- return oid_object_info_extended(r, oid, &oi,
- OBJECT_INFO_DIE_IF_CORRUPT);
+ return odb_read_object_info_extended(r->objects, oid, &oi,
+ OBJECT_INFO_DIE_IF_CORRUPT);
}
/*****************************************************************************
@@ -422,7 +431,7 @@ static int istream_source(struct git_istream *st,
oi.typep = type;
oi.sizep = &size;
- status = oid_object_info_extended(r, oid, &oi, 0);
+ status = odb_read_object_info_extended(r->objects, oid, &oi, 0);
if (status < 0)
return status;