int status;
};
-static const void *feed_input_zstream(struct input_stream *in_stream,
+static const void *feed_input_zstream(struct odb_write_stream *in_stream,
unsigned long *readlen)
{
struct input_zstream_data *data = in_stream->data;
{
git_zstream zstream = { 0 };
struct input_zstream_data data = { 0 };
- struct input_stream in_stream = {
+ struct odb_write_stream in_stream = {
.read = feed_input_zstream,
.data = &data,
};
data.zstream = &zstream;
git_inflate_init(&zstream);
- if (stream_loose_object(the_repository->objects->sources,
- &in_stream, size, &info->oid))
+ if (odb_write_object_stream(the_repository->objects, &in_stream, size, &info->oid))
die(_("failed to write object in stream"));
if (data.status != Z_STREAM_END)
return !!check_and_freshen_source(source, oid, 1);
}
-int stream_loose_object(struct odb_source *source,
- struct input_stream *in_stream, size_t len,
- struct object_id *oid)
+int odb_source_loose_write_stream(struct odb_source *source,
+ struct odb_write_stream *in_stream, size_t len,
+ struct object_id *oid)
{
const struct git_hash_algo *compat = source->odb->repo->compat_hash_algo;
struct object_id compat_oid;
enum object_type type, struct object_id *oid,
struct object_id *compat_oid_in, unsigned flags);
+int odb_source_loose_write_stream(struct odb_source *source,
+ struct odb_write_stream *stream, size_t len,
+ struct object_id *oid);
+
/*
* Populate and return the loose object cache array corresponding to the
* given object ID.
struct object_info;
int parse_loose_header(const char *hdr, struct object_info *oi);
-struct input_stream {
- const void *(*read)(struct input_stream *, unsigned long *len);
- void *data;
- int is_finished;
-};
-
-int stream_loose_object(struct odb_source *source,
- struct input_stream *in_stream, size_t len,
- struct object_id *oid);
-
int force_object_loose(struct odb_source *source,
const struct object_id *oid, time_t mtime);
oid, compat_oid, flags);
}
+int odb_write_object_stream(struct object_database *odb,
+ struct odb_write_stream *stream, size_t len,
+ struct object_id *oid)
+{
+ return odb_source_loose_write_stream(odb->sources, stream, len, oid);
+}
+
struct object_database *odb_new(struct repository *repo)
{
struct object_database *o = xmalloc(sizeof(*o));
return odb_write_object_ext(odb, buf, len, type, oid, NULL, 0);
}
+struct odb_write_stream {
+ const void *(*read)(struct odb_write_stream *, unsigned long *len);
+ void *data;
+ int is_finished;
+};
+
+int odb_write_object_stream(struct object_database *odb,
+ struct odb_write_stream *stream, size_t len,
+ struct object_id *oid);
+
#endif /* ODB_H */