Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3367b66
pack-bitmap: fix memory leak if load_bitmap() failed
ttaylorr Jul 1, 2025
73bf771
pack-bitmap: reword comments in test_bitmap_commits()
brandb97 Jul 1, 2025
bfd5522
pack-bitmap: add load corrupt bitmap test
brandb97 Jul 1, 2025
1ace066
object-store: rename `raw_object_store` to `object_database`
pks-t Jul 1, 2025
a1e2581
object-store: rename `object_directory` to `odb_source`
pks-t Jul 1, 2025
8f49151
object-store: rename files to "odb.{c,h}"
pks-t Jul 1, 2025
2f5181f
odb: introduce parent pointers
pks-t Jul 1, 2025
bd52ea3
odb: get rid of `the_repository` in `find_odb()`
pks-t Jul 1, 2025
9610388
odb: get rid of `the_repository` in `assert_oid_type()`
pks-t Jul 1, 2025
1b1679c
odb: get rid of `the_repository` in `odb_mkstemp()`
pks-t Jul 1, 2025
c44185f
odb: get rid of `the_repository` when handling alternates
pks-t Jul 1, 2025
798c661
odb: get rid of `the_repository` in `for_each()` functions
pks-t Jul 1, 2025
7eafd44
odb: get rid of `the_repository` when handling the primary source
pks-t Jul 1, 2025
fc28a8a
odb: get rid of `the_repository` when handling submodule sources
pks-t Jul 1, 2025
16cf749
odb: trivial refactorings to get rid of `the_repository`
pks-t Jul 1, 2025
e989dd9
odb: rename `oid_object_info()`
pks-t Jul 1, 2025
d4ff88a
odb: rename `repo_read_object_file()`
pks-t Jul 1, 2025
fcf8e3e
odb: rename `has_object()`
pks-t Jul 1, 2025
08218b8
odb: rename `pretend_object_file()`
pks-t Jul 1, 2025
841a03b
odb: rename `read_object_with_reference()`
pks-t Jul 1, 2025
51b50c5
Merge branch 'ps/object-store'
gitster Jul 15, 2025
f31d155
Merge branch 'ly/load-bitmap-leakfix'
gitster Jul 15, 2025
32571a0
The tenth batch
gitster Jul 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Documentation/RelNotes/2.51.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ Performance, Internal Implementation, Development Support etc.
* "make coccicheck" succeeds even when spatch made suggestions, which
has been updated to fail in such a case.

* Code clean-up around object access API.


Fixes since v2.50
-----------------
Expand Down Expand Up @@ -161,6 +163,9 @@ including security updates, are included in this release.
has been corrected.
(merge 2b49d97fcb rp/apply-intent-to-add-fix later to maint).

* Leakfix with a new and a bit invasive test on pack-bitmap files.
(merge bfd5522e98 ly/load-bitmap-leakfix later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge b257adb571 lo/my-first-ow-doc-update later to maint).
(merge 8b34b6a220 ly/sequencer-update-squash-is-fixup-only later to maint).
Expand Down
4 changes: 2 additions & 2 deletions Documentation/user-manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4301,11 +4301,11 @@ Now, for the meat:

-----------------------------------------------------------------------------
case 0:
buf = read_object_with_reference(sha1, argv[1], &size, NULL);
buf = odb_read_object_peeled(r->objects, sha1, argv[1], &size, NULL);
-----------------------------------------------------------------------------

This is how you read a blob (actually, not only a blob, but any type of
object). To know how the function `read_object_with_reference()` actually
object). To know how the function `odb_read_object_peeled()` actually
works, find the source code for it (something like `git grep
read_object_with | grep ":[a-z]"` in the Git repository), and read
the source.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1083,8 +1083,8 @@ LIB_OBJS += notes.o
LIB_OBJS += object-file-convert.o
LIB_OBJS += object-file.o
LIB_OBJS += object-name.o
LIB_OBJS += object-store.o
LIB_OBJS += object.o
LIB_OBJS += odb.o
LIB_OBJS += oid-array.o
LIB_OBJS += oidmap.o
LIB_OBJS += oidset.o
Expand Down
14 changes: 7 additions & 7 deletions apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion archive-tar.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "hex.h"
#include "tar.h"
#include "archive.h"
#include "object-store.h"
#include "odb.h"
#include "strbuf.h"
#include "streaming.h"
#include "run-command.h"
Expand Down
2 changes: 1 addition & 1 deletion archive-zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "hex.h"
#include "streaming.h"
#include "utf8.h"
#include "object-store.h"
#include "odb.h"
#include "strbuf.h"
#include "userdiff.h"
#include "write-or-die.h"
Expand Down
6 changes: 3 additions & 3 deletions archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "pretty.h"
#include "setup.h"
#include "refs.h"
#include "object-store.h"
#include "odb.h"
#include "commit.h"
#include "tree.h"
#include "tree-walk.h"
Expand Down Expand Up @@ -98,7 +98,7 @@ static void *object_file_to_archive(const struct archiver_args *args,
(args->tree ? &args->tree->object.oid : NULL), oid);

path += args->baselen;
buffer = repo_read_object_file(the_repository, oid, type, sizep);
buffer = odb_read_object(the_repository->objects, oid, type, sizep);
if (buffer && S_ISREG(mode)) {
struct strbuf buf = STRBUF_INIT;
size_t size = 0;
Expand Down Expand Up @@ -215,7 +215,7 @@ static int write_archive_entry(const struct object_id *oid, const char *base,

/* Stream it? */
if (S_ISREG(mode) && !args->convert &&
oid_object_info(args->repo, oid, &size) == OBJ_BLOB &&
odb_read_object_info(args->repo->objects, oid, &size) == OBJ_BLOB &&
size > repo_settings_get_big_file_threshold(the_repository))
return write_entry(args, oid, path.buf, path.len, mode, NULL, size);

Expand Down
4 changes: 2 additions & 2 deletions attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "read-cache-ll.h"
#include "refs.h"
#include "revision.h"
#include "object-store.h"
#include "odb.h"
#include "setup.h"
#include "thread-utils.h"
#include "tree-walk.h"
Expand Down Expand Up @@ -779,7 +779,7 @@ static struct attr_stack *read_attr_from_blob(struct index_state *istate,
if (get_tree_entry(istate->repo, tree_oid, path, &oid, &mode))
return NULL;

buf = repo_read_object_file(istate->repo, &oid, &type, &sz);
buf = odb_read_object(istate->repo->objects, &oid, &type, &sz);
if (!buf || type != OBJ_BLOB) {
free(buf);
return NULL;
Expand Down
8 changes: 4 additions & 4 deletions bisect.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "commit-slab.h"
#include "commit-reach.h"
#include "object-name.h"
#include "object-store.h"
#include "odb.h"
#include "path.h"
#include "dir.h"

Expand Down Expand Up @@ -155,9 +155,9 @@ static void show_list(const char *debug, int counted, int nr,
unsigned commit_flags = commit->object.flags;
enum object_type type;
unsigned long size;
char *buf = repo_read_object_file(the_repository,
&commit->object.oid, &type,
&size);
char *buf = odb_read_object(the_repository->objects,
&commit->object.oid, &type,
&size);
const char *subject_start;
int subject_len;

Expand Down
22 changes: 11 additions & 11 deletions blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "git-compat-util.h"
#include "refs.h"
#include "object-store.h"
#include "odb.h"
#include "cache-tree.h"
#include "mergesort.h"
#include "commit.h"
Expand Down Expand Up @@ -116,7 +116,7 @@ static void verify_working_tree_path(struct repository *r,
unsigned short mode;

if (!get_tree_entry(r, commit_oid, path, &blob_oid, &mode) &&
oid_object_info(r, &blob_oid, NULL) == OBJ_BLOB)
odb_read_object_info(r->objects, &blob_oid, NULL) == OBJ_BLOB)
return;
}

Expand Down Expand Up @@ -277,7 +277,8 @@ static struct commit *fake_working_tree_commit(struct repository *r,
convert_to_git(r->index, path, buf.buf, buf.len, &buf, 0);
origin->file.ptr = buf.buf;
origin->file.size = buf.len;
pretend_object_file(the_repository, buf.buf, buf.len, OBJ_BLOB, &origin->blob_oid);
odb_pretend_object(the_repository->objects, buf.buf, buf.len,
OBJ_BLOB, &origin->blob_oid);

/*
* Read the current index, replace the path entry with
Expand Down Expand Up @@ -1041,9 +1042,9 @@ static void fill_origin_blob(struct diff_options *opt,
&o->blob_oid, 1, &file->ptr, &file_size))
;
else
file->ptr = repo_read_object_file(the_repository,
&o->blob_oid, &type,
&file_size);
file->ptr = odb_read_object(the_repository->objects,
&o->blob_oid, &type,
&file_size);
file->size = file_size;

if (!file->ptr)
Expand Down Expand Up @@ -1245,7 +1246,7 @@ static int fill_blob_sha1_and_mode(struct repository *r,
return 0;
if (get_tree_entry(r, &origin->commit->object.oid, origin->path, &origin->blob_oid, &origin->mode))
goto error_out;
if (oid_object_info(r, &origin->blob_oid, NULL) != OBJ_BLOB)
if (odb_read_object_info(r->objects, &origin->blob_oid, NULL) != OBJ_BLOB)
goto error_out;
return 0;
error_out:
Expand Down Expand Up @@ -2869,10 +2870,9 @@ void setup_scoreboard(struct blame_scoreboard *sb,
&sb->final_buf_size))
;
else
sb->final_buf = repo_read_object_file(the_repository,
&o->blob_oid,
&type,
&sb->final_buf_size);
sb->final_buf = odb_read_object(the_repository->objects,
&o->blob_oid, &type,
&sb->final_buf_size);

if (!sb->final_buf)
die(_("cannot read blob %s for path %s"),
Expand Down
6 changes: 3 additions & 3 deletions builtin/backfill.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "tree.h"
#include "tree-walk.h"
#include "object.h"
#include "object-store.h"
#include "odb.h"
#include "oid-array.h"
#include "oidset.h"
#include "promisor-remote.h"
Expand Down Expand Up @@ -67,8 +67,8 @@ static int fill_missing_blobs(const char *path UNUSED,
return 0;

for (size_t i = 0; i < list->nr; i++) {
if (!has_object(ctx->repo, &list->oid[i],
OBJECT_INFO_FOR_PREFETCH))
if (!odb_has_object(ctx->repo->objects, &list->oid[i],
OBJECT_INFO_FOR_PREFETCH))
oid_array_append(&ctx->current_batch, &list->oid[i]);
}

Expand Down
6 changes: 3 additions & 3 deletions builtin/blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "line-log.h"
#include "progress.h"
#include "object-name.h"
#include "object-store.h"
#include "odb.h"
#include "pager.h"
#include "blame.h"
#include "refs.h"
Expand Down Expand Up @@ -837,7 +837,7 @@ static int is_a_rev(const char *name)

if (repo_get_oid(the_repository, name, &oid))
return 0;
return OBJ_NONE < oid_object_info(the_repository, &oid, NULL);
return OBJ_NONE < odb_read_object_info(the_repository->objects, &oid, NULL);
}

static int peel_to_commit_oid(struct object_id *oid_ret, void *cbdata)
Expand All @@ -848,7 +848,7 @@ static int peel_to_commit_oid(struct object_id *oid_ret, void *cbdata)
oidcpy(&oid, oid_ret);
while (1) {
struct object *obj;
int kind = oid_object_info(r, &oid, NULL);
int kind = odb_read_object_info(r->objects, &oid, NULL);
if (kind == OBJ_COMMIT) {
oidcpy(oid_ret, &oid);
return 0;
Expand Down
Loading