[PATCH 13/13] odb/source: drop `read_alternates` callback
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 2, 2026, 10:08 UTC
- Message-ID
- <20261002-pks-odb-move-alternates-v1-13-8a63507b88c4@pks.im>
- In-Reply-To
- <20261002-pks-odb-move-alternates-v1-0-8a63507b88c4@pks.im>
Now that alternates are an implementation detail of the "files" backend there is no reason anymore to expose them anywhere else. The callback to read alternates is thus no longer required. Remove it.
Signed-off-by: Patrick Steinhardt <ps@pks.im> --- odb/source-files.c | 7 ------- odb/source-inmemory.c | 7 ------- odb/source-loose.c | 7 ------- odb/source-packed.c | 7 ------- odb/source.h | 27 --------------------------- 5 files changed, 55 deletions(-)
diff --git a/odb/source-files.c b/odb/source-files.c index 072f515b36..455f409db0 100644 --- a/odb/source-files.c +++ b/odb/source-files.c @@ -594,12 +594,6 @@ static int odb_source_files_begin_transaction(struct odb_source *source, return odb_transaction_files_begin(source, out, flags); } -static int odb_source_files_read_alternates(struct odb_source *source, - struct strvec *out) -{ - return read_alternates(source->path, out); -} - static int too_many_loose_objects(struct odb_source_files *files, int limit) { unsigned long loose_count; @@ -1277,7 +1271,6 @@ struct odb_source_files *odb_source_files_new(struct object_database *odb, files->base.write_object = odb_source_files_write_object; files->base.write_object_stream = odb_source_files_write_object_stream; files->base.begin_transaction = odb_source_files_begin_transaction; - files->base.read_alternates = odb_source_files_read_alternates; files->base.optimize = odb_source_files_optimize; files->base.optimize_required = odb_source_files_optimize_required; files->base.generate_pack = odb_source_files_generate_pack; diff --git a/odb/source-inmemory.c b/odb/source-inmemory.c index f67c74a724..868e723c81 100644 --- a/odb/source-inmemory.c +++ b/odb/source-inmemory.c @@ -322,12 +322,6 @@ static int odb_source_inmemory_begin_transaction(struct odb_source *source UNUSE return error("in-memory source does not support transactions"); } -static int odb_source_inmemory_read_alternates(struct odb_source *source UNUSED, - struct strvec *out UNUSED) -{ - return 0; -} - static void odb_source_inmemory_close(struct odb_source *source UNUSED) { } @@ -390,7 +384,6 @@ struct odb_source_inmemory *odb_source_inmemory_new(struct object_database *odb) source->base.write_object_stream = odb_source_inmemory_write_object_stream; source->base.freshen_object = odb_source_inmemory_freshen_object; source->base.begin_transaction = odb_source_inmemory_begin_transaction; - source->base.read_alternates = odb_source_inmemory_read_alternates; return source; } diff --git a/odb/source-loose.c b/odb/source-loose.c index b2fbccd3c0..0664634938 100644 --- a/odb/source-loose.c +++ b/odb/source-loose.c @@ -985,12 +985,6 @@ static int odb_source_loose_begin_transaction(struct odb_source *source UNUSED, return error("loose source does not support transactions"); } -static int odb_source_loose_read_alternates(struct odb_source *source UNUSED, - struct strvec *out UNUSED) -{ - return 0; -} - static void odb_source_loose_clear_cache(struct odb_source_loose *loose) { oidtree_clear(loose->cache); @@ -1145,7 +1139,6 @@ struct odb_source_loose *odb_source_loose_new(struct object_database *odb, loose->base.write_object = odb_source_loose_write_object; loose->base.write_object_stream = odb_source_loose_write_object_stream; loose->base.begin_transaction = odb_source_loose_begin_transaction; - loose->base.read_alternates = odb_source_loose_read_alternates; if (!is_absolute_path(loose->base.path)) chdir_notify_register(odb_source_loose_reparent, loose); diff --git a/odb/source-packed.c b/odb/source-packed.c index 831501f397..2226fbd313 100644 --- a/odb/source-packed.c +++ b/odb/source-packed.c @@ -687,12 +687,6 @@ static int odb_source_packed_begin_transaction(struct odb_source *source UNUSED, return error("packed backend cannot begin transactions"); } -static int odb_source_packed_read_alternates(struct odb_source *source UNUSED, - struct strvec *out UNUSED) -{ - return 0; -} - void (*report_garbage)(unsigned seen_bits, const char *path); static void report_helper(const struct string_list *list, @@ -1019,7 +1013,6 @@ struct odb_source_packed *odb_source_packed_new(struct object_database *odb, packed->base.write_object = odb_source_packed_write_object; packed->base.write_object_stream = odb_source_packed_write_object_stream; packed->base.begin_transaction = odb_source_packed_begin_transaction; - packed->base.read_alternates = odb_source_packed_read_alternates; if (!is_absolute_path(path)) chdir_notify_register(odb_source_packed_reparent, packed); diff --git a/odb/source.h b/odb/source.h index 6718aced6a..1867347dfc 100644 --- a/odb/source.h +++ b/odb/source.h @@ -258,19 +258,6 @@ struct odb_source { struct odb_transaction **out, enum odb_transaction_flags flags); - /* - * This callback is expected to read the list of alternate object - * database sources connected to it and write them into the `strvec`. - * - * The result is expected to be paths to the alternates. All paths must - * be resolved to absolute paths. - * - * The callback is expected to return 0 on success, a negative error - * code otherwise. - */ - int (*read_alternates)(struct odb_source *source, - struct strvec *out); - /* * This callback is expected to optimize the object database source. * Returns 0 on success, a negative error code otherwise. @@ -507,20 +494,6 @@ static inline int odb_source_write_object_stream(struct odb_source *source, return source->write_object_stream(source, stream, oid); } -/* - * Read the list of alternative object database sources from the given backend - * and populate the `strvec` with them. The listing is not recursive -- that - * is, if any of the yielded alternate sources has alternates itself, those - * will not be yielded as part of this function call. - * - * Return 0 on success, a negative error code otherwise. - */ -static inline int odb_source_read_alternates(struct odb_source *source, - struct strvec *out) -{ - return source->read_alternates(source, out); -} - /* * Create a new transaction that can be used to write objects into a temporary * staging area. The objects will only be persisted when the transaction is
-- 2.56.0.379.gc618271300.dirty