From e7e952f5c27bbca3d98bbcea6d20cd5b63d7d8e5 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 17 Jul 2025 06:56:36 +0200 Subject: object-file: get rid of `the_repository` when writing objects The logic that writes loose objects still relies on `the_repository` to decide where exactly the object shall be written to. Refactor it so that the logic instead operates on a `struct odb_source` so that we can get rid of this global dependency. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- object-file.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'object-file.h') diff --git a/object-file.h b/object-file.h index 8ee24b7d8f..622e2b2bb7 100644 --- a/object-file.h +++ b/object-file.h @@ -157,7 +157,8 @@ enum unpack_loose_header_result unpack_loose_header(git_zstream *stream, struct object_info; int parse_loose_header(const char *hdr, struct object_info *oi); -int write_object_file(const void *buf, unsigned long len, +int write_object_file(struct odb_source *source, + const void *buf, unsigned long len, enum object_type type, struct object_id *oid, struct object_id *compat_oid_in, unsigned flags); @@ -167,7 +168,8 @@ struct input_stream { int is_finished; }; -int stream_loose_object(struct input_stream *in_stream, size_t len, +int stream_loose_object(struct odb_source *source, + struct input_stream *in_stream, size_t len, struct object_id *oid); int force_object_loose(const struct object_id *oid, time_t mtime); -- cgit v1.3