Merge branch 'ps/object-store' into ps/object-file-wo-the-repository
* 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:
@@ -32,7 +32,7 @@
|
||||
#include "list.h"
|
||||
#include "packfile.h"
|
||||
#include "object-file.h"
|
||||
#include "object-store.h"
|
||||
#include "odb.h"
|
||||
#include "replace-object.h"
|
||||
#include "dir.h"
|
||||
#include "midx.h"
|
||||
@@ -349,13 +349,13 @@ static void *get_delta(struct object_entry *entry)
|
||||
void *buf, *base_buf, *delta_buf;
|
||||
enum object_type type;
|
||||
|
||||
buf = repo_read_object_file(the_repository, &entry->idx.oid, &type,
|
||||
&size);
|
||||
buf = odb_read_object(the_repository->objects, &entry->idx.oid,
|
||||
&type, &size);
|
||||
if (!buf)
|
||||
die(_("unable to read %s"), oid_to_hex(&entry->idx.oid));
|
||||
base_buf = repo_read_object_file(the_repository,
|
||||
&DELTA(entry)->idx.oid, &type,
|
||||
&base_size);
|
||||
base_buf = odb_read_object(the_repository->objects,
|
||||
&DELTA(entry)->idx.oid, &type,
|
||||
&base_size);
|
||||
if (!base_buf)
|
||||
die("unable to read %s",
|
||||
oid_to_hex(&DELTA(entry)->idx.oid));
|
||||
@@ -518,9 +518,9 @@ static unsigned long write_no_reuse_object(struct hashfile *f, struct object_ent
|
||||
&size, NULL)) != NULL)
|
||||
buf = NULL;
|
||||
else {
|
||||
buf = repo_read_object_file(the_repository,
|
||||
&entry->idx.oid, &type,
|
||||
&size);
|
||||
buf = odb_read_object(the_repository->objects,
|
||||
&entry->idx.oid, &type,
|
||||
&size);
|
||||
if (!buf)
|
||||
die(_("unable to read %s"),
|
||||
oid_to_hex(&entry->idx.oid));
|
||||
@@ -1907,7 +1907,7 @@ static struct pbase_tree_cache *pbase_tree_get(const struct object_id *oid)
|
||||
/* Did not find one. Either we got a bogus request or
|
||||
* we need to read and perhaps cache.
|
||||
*/
|
||||
data = repo_read_object_file(the_repository, oid, &type, &size);
|
||||
data = odb_read_object(the_repository->objects, oid, &type, &size);
|
||||
if (!data)
|
||||
return NULL;
|
||||
if (type != OBJ_TREE) {
|
||||
@@ -2067,8 +2067,8 @@ static void add_preferred_base(struct object_id *oid)
|
||||
if (window <= num_preferred_base++)
|
||||
return;
|
||||
|
||||
data = read_object_with_reference(the_repository, oid,
|
||||
OBJ_TREE, &size, &tree_oid);
|
||||
data = odb_read_object_peeled(the_repository->objects, oid,
|
||||
OBJ_TREE, &size, &tree_oid);
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
@@ -2166,10 +2166,10 @@ static void prefetch_to_pack(uint32_t object_index_start) {
|
||||
for (i = object_index_start; i < to_pack.nr_objects; i++) {
|
||||
struct object_entry *entry = to_pack.objects + i;
|
||||
|
||||
if (!oid_object_info_extended(the_repository,
|
||||
&entry->idx.oid,
|
||||
NULL,
|
||||
OBJECT_INFO_FOR_PREFETCH))
|
||||
if (!odb_read_object_info_extended(the_repository->objects,
|
||||
&entry->idx.oid,
|
||||
NULL,
|
||||
OBJECT_INFO_FOR_PREFETCH))
|
||||
continue;
|
||||
oid_array_append(&to_fetch, &entry->idx.oid);
|
||||
}
|
||||
@@ -2310,19 +2310,19 @@ static void check_object(struct object_entry *entry, uint32_t object_index)
|
||||
|
||||
/*
|
||||
* No choice but to fall back to the recursive delta walk
|
||||
* with oid_object_info() to find about the object type
|
||||
* with odb_read_object_info() to find about the object type
|
||||
* at this point...
|
||||
*/
|
||||
give_up:
|
||||
unuse_pack(&w_curs);
|
||||
}
|
||||
|
||||
if (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,
|
||||
OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0) {
|
||||
if (odb_read_object_info_extended(the_repository->objects, &entry->idx.oid, &oi,
|
||||
OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0) {
|
||||
if (repo_has_promisor_remote(the_repository)) {
|
||||
prefetch_to_pack(object_index);
|
||||
if (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,
|
||||
OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0)
|
||||
if (odb_read_object_info_extended(the_repository->objects, &entry->idx.oid, &oi,
|
||||
OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0)
|
||||
type = -1;
|
||||
} else {
|
||||
type = -1;
|
||||
@@ -2396,12 +2396,13 @@ static void drop_reused_delta(struct object_entry *entry)
|
||||
if (packed_object_info(the_repository, IN_PACK(entry), entry->in_pack_offset, &oi) < 0) {
|
||||
/*
|
||||
* We failed to get the info from this pack for some reason;
|
||||
* fall back to oid_object_info, which may find another copy.
|
||||
* fall back to odb_read_object_info, which may find another copy.
|
||||
* And if that fails, the error will be recorded in oe_type(entry)
|
||||
* and dealt with in prepare_pack().
|
||||
*/
|
||||
oe_set_type(entry,
|
||||
oid_object_info(the_repository, &entry->idx.oid, &size));
|
||||
odb_read_object_info(the_repository->objects,
|
||||
&entry->idx.oid, &size));
|
||||
} else {
|
||||
oe_set_type(entry, type);
|
||||
}
|
||||
@@ -2689,7 +2690,8 @@ unsigned long oe_get_size_slow(struct packing_data *pack,
|
||||
|
||||
if (e->type_ != OBJ_OFS_DELTA && e->type_ != OBJ_REF_DELTA) {
|
||||
packing_data_lock(&to_pack);
|
||||
if (oid_object_info(the_repository, &e->idx.oid, &size) < 0)
|
||||
if (odb_read_object_info(the_repository->objects,
|
||||
&e->idx.oid, &size) < 0)
|
||||
die(_("unable to get size of %s"),
|
||||
oid_to_hex(&e->idx.oid));
|
||||
packing_data_unlock(&to_pack);
|
||||
@@ -2772,9 +2774,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
|
||||
/* Load data if not already done */
|
||||
if (!trg->data) {
|
||||
packing_data_lock(&to_pack);
|
||||
trg->data = repo_read_object_file(the_repository,
|
||||
&trg_entry->idx.oid, &type,
|
||||
&sz);
|
||||
trg->data = odb_read_object(the_repository->objects,
|
||||
&trg_entry->idx.oid, &type,
|
||||
&sz);
|
||||
packing_data_unlock(&to_pack);
|
||||
if (!trg->data)
|
||||
die(_("object %s cannot be read"),
|
||||
@@ -2787,9 +2789,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
|
||||
}
|
||||
if (!src->data) {
|
||||
packing_data_lock(&to_pack);
|
||||
src->data = repo_read_object_file(the_repository,
|
||||
&src_entry->idx.oid, &type,
|
||||
&sz);
|
||||
src->data = odb_read_object(the_repository->objects,
|
||||
&src_entry->idx.oid, &type,
|
||||
&sz);
|
||||
packing_data_unlock(&to_pack);
|
||||
if (!src->data) {
|
||||
if (src_entry->preferred_base) {
|
||||
@@ -4197,7 +4199,7 @@ static void show_object__ma_allow_any(struct object *obj, const char *name, void
|
||||
* Quietly ignore ALL missing objects. This avoids problems with
|
||||
* staging them now and getting an odd error later.
|
||||
*/
|
||||
if (!has_object(the_repository, &obj->oid, 0))
|
||||
if (!odb_has_object(the_repository->objects, &obj->oid, 0))
|
||||
return;
|
||||
|
||||
show_object(obj, name, data);
|
||||
@@ -4211,7 +4213,7 @@ static void show_object__ma_allow_promisor(struct object *obj, const char *name,
|
||||
* Quietly ignore EXPECTED missing objects. This avoids problems with
|
||||
* staging them now and getting an odd error later.
|
||||
*/
|
||||
if (!has_object(the_repository, &obj->oid, 0) &&
|
||||
if (!odb_has_object(the_repository->objects, &obj->oid, 0) &&
|
||||
is_promisor_object(to_pack.repo, &obj->oid))
|
||||
return;
|
||||
|
||||
@@ -4294,7 +4296,7 @@ static void add_objects_in_unpacked_packs(void)
|
||||
static int add_loose_object(const struct object_id *oid, const char *path,
|
||||
void *data UNUSED)
|
||||
{
|
||||
enum object_type type = oid_object_info(the_repository, oid, NULL);
|
||||
enum object_type type = odb_read_object_info(the_repository->objects, oid, NULL);
|
||||
|
||||
if (type < 0) {
|
||||
warning(_("loose object at %s could not be examined"), path);
|
||||
@@ -4771,7 +4773,7 @@ static int option_parse_cruft_expiration(const struct option *opt UNUSED,
|
||||
static int is_not_in_promisor_pack_obj(struct object *obj, void *data UNUSED)
|
||||
{
|
||||
struct object_info info = OBJECT_INFO_INIT;
|
||||
if (oid_object_info_extended(the_repository, &obj->oid, &info, 0))
|
||||
if (odb_read_object_info_extended(the_repository->objects, &obj->oid, &info, 0))
|
||||
BUG("should_include_obj should only be called on existing objects");
|
||||
return info.whence != OI_PACKED || !info.u.packed.pack->pack_promisor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user