From ab1c6e1d12e869cbca3ea7f8a4e767e45fd14c49 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 17 Jul 2025 06:56:35 +0200 Subject: odb: introduce `odb_write_object()` We do not have a backend-agnostic way to write objects into an object database. While there is `write_object_file()`, this function is rather specific to the loose object format. Introduce `odb_write_object()` to plug this gap. For now, this function is a simple wrapper around `write_object_file()` and doesn't even use the passed-in object database yet. This will change in subsequent commits, where `write_object_file()` is converted so that it works on top of an `odb_source`. `odb_write_object()` will then become responsible for deciding which source an object shall be written to. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- builtin/replace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'builtin/replace.c') diff --git a/builtin/replace.c b/builtin/replace.c index 5ff2ab723c..7c46d05ec1 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -488,7 +488,8 @@ static int create_graft(int argc, const char **argv, int force, int gentle) return -1; } - if (write_object_file(buf.buf, buf.len, OBJ_COMMIT, &new_oid)) { + if (odb_write_object(the_repository->objects, buf.buf, + buf.len, OBJ_COMMIT, &new_oid)) { strbuf_release(&buf); return error(_("could not write replacement commit for: '%s'"), old_ref); -- cgit v1.2.3