diff options
author | Patrick Steinhardt <ps@pks.im> | 2025-07-01 14:22:20 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2025-07-01 14:46:36 -0700 |
commit | c44185f6c10fb2d306efe505112982a7c3b93789 (patch) | |
tree | 98e2f1411a2f14a3be954f8ef16f0ccf78d77005 /object-file.c | |
parent | 1b1679c6883f948b19599f11229ff61124b51733 (diff) |
odb: get rid of `the_repository` when handling alternates
The functions to manage alternates all depend on `the_repository`.
Refactor them to accept an object database as a parameter and adjust all
callers. The functions are renamed accordingly.
Note that right now the situation is still somewhat weird because we end
up using the object store path provided by the object store's repository
anyway. Consequently, we could have instead passed in a pointer to the
repository instead of passing in the pointer to the object store. This
will be addressed in subsequent commits though, where we will start to
use the path owned by the object store itself.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-file.c')
-rw-r--r-- | object-file.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/object-file.c b/object-file.c index 2d3af8a77c..04da19a1a3 100644 --- a/object-file.c +++ b/object-file.c @@ -106,7 +106,7 @@ static int check_and_freshen_nonlocal(const struct object_id *oid, int freshen) { struct odb_source *source; - prepare_alt_odb(the_repository); + odb_prepare_alternates(the_repository->objects); for (source = the_repository->objects->sources->next; source; source = source->next) { if (check_and_freshen_odb(source, oid, freshen)) return 1; @@ -205,7 +205,7 @@ static int stat_loose_object(struct repository *r, const struct object_id *oid, struct odb_source *source; static struct strbuf buf = STRBUF_INIT; - prepare_alt_odb(r); + odb_prepare_alternates(r->objects); for (source = r->objects->sources; source; source = source->next) { *path = odb_loose_path(source, &buf, oid); if (!lstat(*path, st)) @@ -227,7 +227,7 @@ static int open_loose_object(struct repository *r, int most_interesting_errno = ENOENT; static struct strbuf buf = STRBUF_INIT; - prepare_alt_odb(r); + odb_prepare_alternates(r->objects); for (source = r->objects->sources; source; source = source->next) { *path = odb_loose_path(source, &buf, oid); fd = git_open(*path); @@ -246,7 +246,7 @@ static int quick_has_loose(struct repository *r, { struct odb_source *source; - prepare_alt_odb(r); + odb_prepare_alternates(r->objects); for (source = r->objects->sources; source; source = source->next) { if (oidtree_contains(odb_loose_cache(source, oid), oid)) return 1; @@ -1439,7 +1439,7 @@ int for_each_loose_object(each_loose_object_fn cb, void *data, { struct odb_source *source; - prepare_alt_odb(the_repository); + odb_prepare_alternates(the_repository->objects); for (source = the_repository->objects->sources; source; source = source->next) { int r = for_each_loose_file_in_objdir(source->path, cb, NULL, NULL, data); |