diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-07-17 06:56:35 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-07-16 22:16:15 -0700 |
| commit | ab1c6e1d12e869cbca3ea7f8a4e767e45fd14c49 (patch) | |
| tree | 32a6815af9b9ec50578da260882e52ab9de8182f /merge-ort.c | |
| parent | loose: write loose objects map via their source (diff) | |
| download | git-ab1c6e1d12e869cbca3ea7f8a4e767e45fd14c49.tar.gz git-ab1c6e1d12e869cbca3ea7f8a4e767e45fd14c49.zip | |
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 <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-ort.c')
| -rw-r--r-- | merge-ort.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/merge-ort.c b/merge-ort.c index 473ff61e36..535ef3efc6 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -2216,8 +2216,8 @@ static int handle_content_merge(struct merge_options *opt, } if (!ret && record_object && - write_object_file(result_buf.ptr, result_buf.size, - OBJ_BLOB, &result->oid)) { + odb_write_object(the_repository->objects, result_buf.ptr, result_buf.size, + OBJ_BLOB, &result->oid)) { path_msg(opt, ERROR_OBJECT_WRITE_FAILED, 0, pathnames[0], pathnames[1], pathnames[2], NULL, _("error: unable to add %s to database"), path); @@ -3772,7 +3772,8 @@ static int write_tree(struct object_id *result_oid, } /* Write this object file out, and record in result_oid */ - if (write_object_file(buf.buf, buf.len, OBJ_TREE, result_oid)) + if (odb_write_object(the_repository->objects, buf.buf, + buf.len, OBJ_TREE, result_oid)) ret = -1; strbuf_release(&buf); return ret; |
