Merge branch 'ps/object-file-wo-the-repository'

Reduce implicit assumption and dependence on the_repository in the
object-file subsystem.

* ps/object-file-wo-the-repository:
  object-file: get rid of `the_repository` in index-related functions
  object-file: get rid of `the_repository` in `force_object_loose()`
  object-file: get rid of `the_repository` in `read_loose_object()`
  object-file: get rid of `the_repository` in loose object iterators
  object-file: remove declaration for `for_each_file_in_obj_subdir()`
  object-file: inline `for_each_loose_file_in_objdir_buf()`
  object-file: get rid of `the_repository` when writing objects
  odb: introduce `odb_write_object()`
  loose: write loose objects map via their source
  object-file: get rid of `the_repository` in `finalize_object_file()`
  object-file: get rid of `the_repository` in `loose_object_info()`
  object-file: get rid of `the_repository` when freshening objects
  object-file: inline `check_and_freshen()` functions
  object-file: get rid of `the_repository` in `has_loose_object()`
  object-file: stop using `the_hash_algo`
  object-file: fix -Wsign-compare warnings
This commit is contained in:
Junio C Hamano
2025-08-05 11:53:55 -07:00
39 changed files with 332 additions and 293 deletions

View File

@@ -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;