summaryrefslogtreecommitdiff
path: root/streaming.c
diff options
context:
space:
mode:
Diffstat (limited to 'streaming.c')
-rw-r--r--streaming.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/streaming.c b/streaming.c
index fe54665..10adf62 100644
--- a/streaming.c
+++ b/streaming.c
@@ -1,10 +1,13 @@
/*
* Copyright (c) 2011, Google Inc.
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "convert.h"
+#include "environment.h"
#include "streaming.h"
#include "repository.h"
-#include "object-store.h"
+#include "object-file.h"
+#include "object-store-ll.h"
#include "replace-object.h"
#include "packfile.h"
@@ -38,7 +41,7 @@ struct git_istream {
union {
struct {
- char *buf; /* from read_object() */
+ char *buf; /* from oid_object_info_extended() */
unsigned long read_ptr;
} incore;
@@ -328,9 +331,9 @@ static int close_istream_pack_non_delta(struct git_istream *st)
}
static int open_istream_pack_non_delta(struct git_istream *st,
- struct repository *r,
- const struct object_id *oid,
- enum object_type *type)
+ struct repository *r UNUSED,
+ const struct object_id *oid UNUSED,
+ enum object_type *type UNUSED)
{
struct pack_window *window;
enum object_type in_pack_type;
@@ -388,12 +391,17 @@ static ssize_t read_istream_incore(struct git_istream *st, char *buf, size_t sz)
static int open_istream_incore(struct git_istream *st, struct repository *r,
const struct object_id *oid, enum object_type *type)
{
- st->u.incore.buf = read_object_file_extended(r, oid, type, &st->size, 0);
+ struct object_info oi = OBJECT_INFO_INIT;
+
st->u.incore.read_ptr = 0;
st->close = close_istream_incore;
st->read = read_istream_incore;
- return st->u.incore.buf ? 0 : -1;
+ 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);
}
/*****************************************************************************