From: Han Xin <hanxin.hx@xxxxxxxxxxxxxxx> For large loose object files, that should be possible to stream it direct to disk with "write_loose_object()". Unlike "write_object_file()", you need to implement an "input_stream" instead of giving void *buf. Signed-off-by: Han Xin <hanxin.hx@xxxxxxxxxxxxxxx> --- object-file.c | 8 ++++---- object-store.h | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/object-file.c b/object-file.c index e333448c54..60eb29db97 100644 --- a/object-file.c +++ b/object-file.c @@ -1878,10 +1878,10 @@ static const char *read_input_stream_from_buffer(void *data, unsigned long *len) return input->buf; } -static int write_loose_object(const struct object_id *oid, char *hdr, - int hdrlen, struct input_stream *in_stream, - int dry_run, - time_t mtime, unsigned flags) +int write_loose_object(const struct object_id *oid, char *hdr, + int hdrlen, struct input_stream *in_stream, + int dry_run, + time_t mtime, unsigned flags) { int fd, ret = 0; unsigned char compressed[4096]; diff --git a/object-store.h b/object-store.h index f1b67e9100..f6faa8d6d3 100644 --- a/object-store.h +++ b/object-store.h @@ -228,6 +228,11 @@ int hash_object_file(const struct git_hash_algo *algo, const void *buf, unsigned long len, const char *type, struct object_id *oid); +int write_loose_object(const struct object_id *oid, char *hdr, + int hdrlen, struct input_stream *in_stream, + int dry_run, + time_t mtime, unsigned flags); + int write_object_file_flags(const void *buf, unsigned long len, const char *type, struct object_id *oid, unsigned flags); -- 2.33.1.44.g9344627884.agit.6.5.4