aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-07-01 14:22:14 +0200
committerJunio C Hamano <gitster@pobox.com>2025-07-01 14:46:34 -0700
commita1e2581a1e9ca2a85ae0a018ba5fb8fe5db3c322 (patch)
tree8443c60b4d56d958eef875e53afa3a33c9643d37 /builtin
parent1ace06644926bcf1f05e291e8a9476c977c25eeb (diff)
downloadgit-a1e2581a1e9ca2a85ae0a018ba5fb8fe5db3c322.tar.gz
object-store: rename `object_directory` to `odb_source`
The `object_directory` structure is used as an access point for a single object directory like ".git/objects". While the structure isn't yet fully self-contained, the intent is for it to eventually contain all information required to access objects in one specific location. While the name "object directory" is a good fit for now, this will change over time as we continue with the agenda to make pluggable object databases a thing. Eventually, objects may not be accessed via any kind of directory at all anymore, but they could instead be backed by any kind of durable storage mechanism. While it seems quite far-fetched for now, it is thinkable that eventually this might even be some form of a database, for example. As such, the current name of this structure will become worse over time as we evolve into the direction of pluggable ODBs. Immediate next steps will start to carve out proper self-contained object directories, which requires us to pass in these object directories as parameters. Based on our modern naming schema this means that those functions should then be named after their subsystem, which means that we would start to bake the current name into the codebase more and more. Let's preempt this by renaming the structure. There have been a couple alternatives that were discussed: - `odb_backend` was discarded because it led to the association that one object database has a single backend, but the model is that one alternate has one backend. Furthermore, "backend" is more about the actual backing implementation and less about the high-level concept. - `odb_alternate` was discarded because it is a bit of a stretch to also call the main object directory an "alternate". Instead, pick `odb_source` as the new name. It makes it sufficiently clear that there can be multiple sources and does not cause confusion when mixed with the already-existing "alternate" terminology. In the future, this change allows us to easily introduce for example a `odb_files_source` and other format-specific implementations. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit-graph.c18
-rw-r--r--builtin/count-objects.c4
-rw-r--r--builtin/fetch.c2
-rw-r--r--builtin/fsck.c14
-rw-r--r--builtin/gc.c14
-rw-r--r--builtin/grep.c2
-rw-r--r--builtin/multi-pack-index.c4
-rw-r--r--builtin/submodule--helper.c6
8 files changed, 32 insertions, 32 deletions
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index a783a86e79..98a8431534 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -66,7 +66,7 @@ static int graph_verify(int argc, const char **argv, const char *prefix,
struct repository *repo UNUSED)
{
struct commit_graph *graph = NULL;
- struct object_directory *odb = NULL;
+ struct odb_source *source = NULL;
char *graph_name;
char *chain_name;
enum { OPENED_NONE, OPENED_GRAPH, OPENED_CHAIN } opened = OPENED_NONE;
@@ -101,9 +101,9 @@ static int graph_verify(int argc, const char **argv, const char *prefix,
if (opts.progress)
flags |= COMMIT_GRAPH_WRITE_PROGRESS;
- odb = find_odb(the_repository, opts.obj_dir);
- graph_name = get_commit_graph_filename(odb);
- chain_name = get_commit_graph_chain_filename(odb);
+ source = find_odb(the_repository, opts.obj_dir);
+ graph_name = get_commit_graph_filename(source);
+ chain_name = get_commit_graph_chain_filename(source);
if (open_commit_graph(graph_name, &fd, &st))
opened = OPENED_GRAPH;
else if (errno != ENOENT)
@@ -120,7 +120,7 @@ static int graph_verify(int argc, const char **argv, const char *prefix,
if (opened == OPENED_NONE)
return 0;
else if (opened == OPENED_GRAPH)
- graph = load_commit_graph_one_fd_st(the_repository, fd, &st, odb);
+ graph = load_commit_graph_one_fd_st(the_repository, fd, &st, source);
else
graph = load_commit_graph_chain_fd_st(the_repository, fd, &st,
&incomplete_chain);
@@ -221,7 +221,7 @@ static int graph_write(int argc, const char **argv, const char *prefix,
struct string_list pack_indexes = STRING_LIST_INIT_DUP;
struct strbuf buf = STRBUF_INIT;
struct oidset commits = OIDSET_INIT;
- struct object_directory *odb = NULL;
+ struct odb_source *source = NULL;
int result = 0;
enum commit_graph_write_flags flags = 0;
struct progress *progress = NULL;
@@ -289,10 +289,10 @@ static int graph_write(int argc, const char **argv, const char *prefix,
git_env_bool(GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS, 0))
flags |= COMMIT_GRAPH_WRITE_BLOOM_FILTERS;
- odb = find_odb(the_repository, opts.obj_dir);
+ source = find_odb(the_repository, opts.obj_dir);
if (opts.reachable) {
- if (write_commit_graph_reachable(odb, flags, &write_opts))
+ if (write_commit_graph_reachable(source, flags, &write_opts))
result = 1;
goto cleanup;
}
@@ -318,7 +318,7 @@ static int graph_write(int argc, const char **argv, const char *prefix,
stop_progress(&progress);
}
- if (write_commit_graph(odb,
+ if (write_commit_graph(source,
opts.stdin_packs ? &pack_indexes : NULL,
opts.stdin_commits ? &commits : NULL,
flags,
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index a88c0c9c09..58e0af433d 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -80,10 +80,10 @@ static int count_cruft(const char *basename UNUSED, const char *path,
return 0;
}
-static int print_alternate(struct object_directory *odb, void *data UNUSED)
+static int print_alternate(struct odb_source *alternate, void *data UNUSED)
{
printf("alternate: ");
- quote_c_style(odb->path, NULL, stdout, 0);
+ quote_c_style(alternate->path, NULL, stdout, 0);
putchar('\n');
return 0;
}
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 40a0e8d244..a890e2864d 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -2653,7 +2653,7 @@ int cmd_fetch(int argc,
commit_graph_flags |= COMMIT_GRAPH_WRITE_PROGRESS;
trace2_region_enter("fetch", "write-commit-graph", the_repository);
- write_commit_graph_reachable(the_repository->objects->odb,
+ write_commit_graph_reachable(the_repository->objects->sources,
commit_graph_flags,
NULL);
trace2_region_leave("fetch", "write-commit-graph", the_repository);
diff --git a/builtin/fsck.c b/builtin/fsck.c
index e7d96a9c8e..6e1474f63d 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -956,7 +956,7 @@ int cmd_fsck(int argc,
struct repository *repo UNUSED)
{
int i;
- struct object_directory *odb;
+ struct odb_source *source;
/* fsck knows how to handle missing promisor objects */
fetch_if_missing = 0;
@@ -998,8 +998,8 @@ int cmd_fsck(int argc,
mark_packed_for_connectivity, NULL, 0);
} else {
prepare_alt_odb(the_repository);
- for (odb = the_repository->objects->odb; odb; odb = odb->next)
- fsck_object_dir(odb->path);
+ for (source = the_repository->objects->sources; source; source = source->next)
+ fsck_object_dir(source->path);
if (check_full) {
struct packed_git *p;
@@ -1109,11 +1109,11 @@ int cmd_fsck(int argc,
struct child_process commit_graph_verify = CHILD_PROCESS_INIT;
prepare_alt_odb(the_repository);
- for (odb = the_repository->objects->odb; odb; odb = odb->next) {
+ for (source = the_repository->objects->sources; source; source = source->next) {
child_process_init(&commit_graph_verify);
commit_graph_verify.git_cmd = 1;
strvec_pushl(&commit_graph_verify.args, "commit-graph",
- "verify", "--object-dir", odb->path, NULL);
+ "verify", "--object-dir", source->path, NULL);
if (show_progress)
strvec_push(&commit_graph_verify.args, "--progress");
else
@@ -1127,11 +1127,11 @@ int cmd_fsck(int argc,
struct child_process midx_verify = CHILD_PROCESS_INIT;
prepare_alt_odb(the_repository);
- for (odb = the_repository->objects->odb; odb; odb = odb->next) {
+ for (source = the_repository->objects->sources; source; source = source->next) {
child_process_init(&midx_verify);
midx_verify.git_cmd = 1;
strvec_pushl(&midx_verify.args, "multi-pack-index",
- "verify", "--object-dir", odb->path, NULL);
+ "verify", "--object-dir", source->path, NULL);
if (show_progress)
strvec_push(&midx_verify.args, "--progress");
else
diff --git a/builtin/gc.c b/builtin/gc.c
index e33ba946e4..50a09eb07e 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1018,7 +1018,7 @@ int cmd_gc(int argc,
}
if (the_repository->settings.gc_write_commit_graph == 1)
- write_commit_graph_reachable(the_repository->objects->odb,
+ write_commit_graph_reachable(the_repository->objects->sources,
!quiet && !daemonized ? COMMIT_GRAPH_WRITE_PROGRESS : 0,
NULL);
@@ -1271,7 +1271,7 @@ static int loose_object_auto_condition(struct gc_config *cfg UNUSED)
if (loose_object_auto_limit < 0)
return 1;
- return for_each_loose_file_in_objdir(the_repository->objects->odb->path,
+ return for_each_loose_file_in_objdir(the_repository->objects->sources->path,
loose_object_count,
NULL, NULL, &count);
}
@@ -1306,7 +1306,7 @@ static int pack_loose(struct maintenance_run_opts *opts)
* Do not start pack-objects process
* if there are no loose objects.
*/
- if (!for_each_loose_file_in_objdir(r->objects->odb->path,
+ if (!for_each_loose_file_in_objdir(r->objects->sources->path,
bail_on_loose,
NULL, NULL, NULL))
return 0;
@@ -1318,7 +1318,7 @@ static int pack_loose(struct maintenance_run_opts *opts)
strvec_push(&pack_proc.args, "--quiet");
else
strvec_push(&pack_proc.args, "--no-quiet");
- strvec_pushf(&pack_proc.args, "%s/pack/loose", r->objects->odb->path);
+ strvec_pushf(&pack_proc.args, "%s/pack/loose", r->objects->sources->path);
pack_proc.in = -1;
@@ -1346,7 +1346,7 @@ static int pack_loose(struct maintenance_run_opts *opts)
else if (data.batch_size > 0)
data.batch_size--; /* Decrease for equality on limit. */
- for_each_loose_file_in_objdir(r->objects->odb->path,
+ for_each_loose_file_in_objdir(r->objects->sources->path,
write_loose_object_to_stdin,
NULL,
NULL,
@@ -1611,7 +1611,7 @@ static int maintenance_run_tasks(struct maintenance_run_opts *opts,
int result = 0;
struct lock_file lk;
struct repository *r = the_repository;
- char *lock_path = xstrfmt("%s/maintenance", r->objects->odb->path);
+ char *lock_path = xstrfmt("%s/maintenance", r->objects->sources->path);
if (hold_lock_file_for_update(&lk, lock_path, LOCK_NO_DEREF) < 0) {
/*
@@ -3083,7 +3083,7 @@ static int update_background_schedule(const struct maintenance_start_opts *opts,
unsigned int i;
int result = 0;
struct lock_file lk;
- char *lock_path = xstrfmt("%s/schedule", the_repository->objects->odb->path);
+ char *lock_path = xstrfmt("%s/schedule", the_repository->objects->sources->path);
if (hold_lock_file_for_update(&lk, lock_path, LOCK_NO_DEREF) < 0) {
if (errno == EEXIST)
diff --git a/builtin/grep.c b/builtin/grep.c
index 3ce574a605..76b1938bba 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -505,7 +505,7 @@ static int grep_submodule(struct grep_opt *opt,
* lazily registered as alternates when needed (and except in an
* unexpected code interaction, it won't be needed).
*/
- add_submodule_odb_by_path(subrepo->objects->odb->path);
+ add_submodule_odb_by_path(subrepo->objects->sources->path);
obj_read_unlock();
memcpy(&subopt, opt, sizeof(subopt));
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index 69a9750732..f55bf53da8 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -294,8 +294,8 @@ int cmd_multi_pack_index(int argc,
if (the_repository &&
the_repository->objects &&
- the_repository->objects->odb)
- opts.object_dir = xstrdup(the_repository->objects->odb->path);
+ the_repository->objects->sources)
+ opts.object_dir = xstrdup(the_repository->objects->sources->path);
argc = parse_options(argc, argv, prefix, options,
builtin_multi_pack_index_usage, 0);
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 53da2116dd..758bc6d0f2 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1582,7 +1582,7 @@ static const char alternate_error_advice[] = N_(
);
static int add_possible_reference_from_superproject(
- struct object_directory *odb, void *sas_cb)
+ struct odb_source *alt_odb, void *sas_cb)
{
struct submodule_alternate_setup *sas = sas_cb;
size_t len;
@@ -1591,12 +1591,12 @@ static int add_possible_reference_from_superproject(
* If the alternate object store is another repository, try the
* standard layout with .git/(modules/<name>)+/objects
*/
- if (strip_suffix(odb->path, "/objects", &len)) {
+ if (strip_suffix(alt_odb->path, "/objects", &len)) {
struct repository alternate;
char *sm_alternate;
struct strbuf sb = STRBUF_INIT;
struct strbuf err = STRBUF_INIT;
- strbuf_add(&sb, odb->path, len);
+ strbuf_add(&sb, alt_odb->path, len);
if (repo_init(&alternate, sb.buf, NULL) < 0)
die(_("could not get a repository handle for gitdir '%s'"),