git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 13/13] odb: remove the ability to link sources ad-hoc

From
Patrick Steinhardt <ps@pks.im>
Date
Sep 2, 2026, 13:35 UTC
Message-ID
<20260902-pks-odb-registering-in-memory-sources-v2-13-c6ca12fdea4d@pks.im>
In-Reply-To
<20260902-pks-odb-registering-in-memory-sources-v2-0-c6ca12fdea4d@pks.im>

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>
---
 odb.c | 6 ------
 odb.h | 8 --------
 2 files changed, 14 deletions(-)
diff --git a/odb.c b/odb.c
index 2f8a70a90c..5fe081496f 100644
--- a/odb.c
+++ b/odb.c
@@ -247,12 +247,6 @@ void odb_add_to_alternates_file(struct object_database *odb,
 	odb_add_alternate_recursively(odb, dir, 0);
 }
 
-struct odb_source *odb_add_to_alternates_memory(struct object_database *odb,
-						const char *dir)
-{
-	return odb_add_alternate_recursively(odb, dir, 0);
-}
-
 struct odb_source *odb_set_temporary_primary_source(struct object_database *odb,
 						    const char *dir, int will_destroy,
 						    struct odb_source **prev_source)
diff --git a/odb.h b/odb.h
index 54548efc55..9025239df5 100644
--- a/odb.h
+++ b/odb.h
@@ -258,14 +258,6 @@ int odb_has_alternates(struct object_database *odb);
 void odb_add_to_alternates_file(struct object_database *odb,
 				const char *dir);
 
-/*
- * Add the directory to the in-memory list of alternate sources (along with any
- * recursive alternates it points to), but do not modify the on-disk alternates
- * file.
- */
-struct odb_source *odb_add_to_alternates_memory(struct object_database *odb,
-						const char *dir);
-
 /*
  * Read an object from the database. Returns the object data and assigns object
  * type and size to the `type` and `size` pointers, if these pointers are
-- 
2.55.0.979.g7e5102b832.dirty
Previous: Patrick SteinhardtNext: Karthik Nayak
Message 22 of 23 in “odb: stop registering in-memory sources”
  1. 00/13 odb: stop registering in-memory sourcesPatrick Steinhardt, Sep 2, 2026
  2. 01/13 cache-tree: drop `the_repository` in `cache_tree_fully_valid()`Patrick Steinhardt, Sep 2, 2026
  3. 02/13 cache-tree: remove dependency on `the_repository`Patrick Steinhardt, Sep 2, 2026
  4. Karthik NayakSep 4, 2026
  5. Patrick SteinhardtSep 7, 2026
  6. 03/13 submodule-config: remove uses of `the_repository`Patrick Steinhardt, Sep 2, 2026
  7. 04/13 submodule-config: stop using `the_hash_algo`Patrick Steinhardt, Sep 2, 2026
  8. 05/13 submodule-config: stop registering submodule sourcesPatrick Steinhardt, Sep 2, 2026
  9. Justin ToblerSep 6, 2026
  10. Patrick SteinhardtSep 7, 2026
  11. Justin ToblerSep 8, 2026
  12. Patrick SteinhardtSep 9, 2026
  13. 06/13 builtin/grep: stop registering submodule ODB as sourcePatrick Steinhardt, Sep 2, 2026
  14. 07/13 odb: remove infrastructure to register submodule sourcesPatrick Steinhardt, Sep 2, 2026
  15. Karthik NayakSep 4, 2026
  16. 08/13 tmp-objdir: drop unused function to register alternatePatrick Steinhardt, Sep 2, 2026
  17. 09/13 odb/packed: fix memory leaks when freeing sourcePatrick Steinhardt, Sep 2, 2026
  18. 10/13 builtin/multi-pack-index: refuse unknown sources with "--object-dir="Patrick Steinhardt, Sep 2, 2026
  19. Justin ToblerSep 8, 2026
  20. 11/13 t/helper: adapt read-midx to not link ad-hoc source anymorePatrick Steinhardt, Sep 2, 2026
  21. 12/13 t/helper: stop registering alternates in "ref-store" commandPatrick Steinhardt, Sep 2, 2026
  22. 13/13 odb: remove the ability to link sources ad-hocPatrick Steinhardt, Sep 2, 2026
  23. Karthik NayakSep 4, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.