Merge branch 'ps/object-store'

Code clean-up around object access API.

* ps/object-store:
  odb: rename `read_object_with_reference()`
  odb: rename `pretend_object_file()`
  odb: rename `has_object()`
  odb: rename `repo_read_object_file()`
  odb: rename `oid_object_info()`
  odb: trivial refactorings to get rid of `the_repository`
  odb: get rid of `the_repository` when handling submodule sources
  odb: get rid of `the_repository` when handling the primary source
  odb: get rid of `the_repository` in `for_each()` functions
  odb: get rid of `the_repository` when handling alternates
  odb: get rid of `the_repository` in `odb_mkstemp()`
  odb: get rid of `the_repository` in `assert_oid_type()`
  odb: get rid of `the_repository` in `find_odb()`
  odb: introduce parent pointers
  object-store: rename files to "odb.{c,h}"
  object-store: rename `object_directory` to `odb_source`
  object-store: rename `raw_object_store` to `object_database`
This commit is contained in:
Junio C Hamano
2025-07-15 15:18:17 -07:00
140 changed files with 1453 additions and 1297 deletions

14
apply.c
View File

@@ -14,7 +14,7 @@
#include "abspath.h"
#include "base85.h"
#include "config.h"
#include "object-store.h"
#include "odb.h"
#include "delta.h"
#include "diff.h"
#include "dir.h"
@@ -3204,14 +3204,14 @@ static int apply_binary(struct apply_state *state,
return 0; /* deletion patch */
}
if (has_object(the_repository, &oid, 0)) {
if (odb_has_object(the_repository->objects, &oid, 0)) {
/* We already have the postimage */
enum object_type type;
unsigned long size;
char *result;
result = repo_read_object_file(the_repository, &oid, &type,
&size);
result = odb_read_object(the_repository->objects, &oid,
&type, &size);
if (!result)
return error(_("the necessary postimage %s for "
"'%s' cannot be read"),
@@ -3273,8 +3273,8 @@ static int read_blob_object(struct strbuf *buf, const struct object_id *oid, uns
unsigned long sz;
char *result;
result = repo_read_object_file(the_repository, oid, &type,
&sz);
result = odb_read_object(the_repository->objects, oid,
&type, &sz);
if (!result)
return -1;
/* XXX read_sha1_file NUL-terminates */
@@ -3503,7 +3503,7 @@ static int resolve_to(struct image *image, const struct object_id *result_id)
image_clear(image);
data = repo_read_object_file(the_repository, result_id, &type, &size);
data = odb_read_object(the_repository->objects, result_id, &type, &size);
if (!data || type != OBJ_BLOB)
die("unable to read blob object %s", oid_to_hex(result_id));
strbuf_attach(&image->buf, data, size, size + 1);