Commit

f0eb23a8f57d06cd461e72b35caf500145980ce8

odb: remove the ability to link sources ad-hoc

Over the course of this patch series we have adapted all callers of
`odb_add_to_alternates_memory()` to not do so anymore. Remove the
function.

This series of refactorings doesn't only simplify our code base. More
importantly, with those changes in place we can now unconditionally
assume that the list of sources linked to the object database only
consists of the primary source and its alternates. This serves as the
foundation to eventually move handling of alternates into the "files"
backend itself.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt <ps@pks.im> · 2026-09-11 05:51 UTC · committed by Junio C Hamano

Browse files
2 files changed, +0 −14
modified odb.c
@@ -247,12 +247,6 @@ void odb_add_to_alternates_file(struct object_database *odb,
247 247 odb_add_alternate_recursively(odb, dir, 0);
248 248 }
249 249
250 - struct odb_source *odb_add_to_alternates_memory(struct object_database *odb,
251 - const char *dir)
252 - {
253 - return odb_add_alternate_recursively(odb, dir, 0);
254 - }
255 -
256 250 struct odb_source *odb_set_temporary_primary_source(struct object_database *odb,
257 251 const char *dir, int will_destroy,
258 252 struct odb_source **prev_source)
modified odb.h
@@ -258,14 +258,6 @@ int odb_has_alternates(struct object_database *odb);
258 258 void odb_add_to_alternates_file(struct object_database *odb,
259 259 const char *dir);
260 260
261 - /*
262 - * Add the directory to the in-memory list of alternate sources (along with any
263 - * recursive alternates it points to), but do not modify the on-disk alternates
264 - * file.
265 - */
266 - struct odb_source *odb_add_to_alternates_memory(struct object_database *odb,
267 - const char *dir);
268 -
269 261 /*
270 262 * Read an object from the database. Returns the object data and assigns object
271 263 * type and size to the `type` and `size` pointers, if these pointers are