aboutsummaryrefslogtreecommitdiffstats
path: root/object-file.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-11-03 08:42:00 +0100
committerJunio C Hamano <gitster@pobox.com>2025-11-03 12:18:46 -0800
commitece43d9dc70b1717484ee78b66aef4f9390c2b2b (patch)
tree614ea40a974968ea8ddd66da95edf7575295973c /object-file.c
parentobject-file: move `fetch_if_missing` (diff)
downloadgit-ece43d9dc70b1717484ee78b66aef4f9390c2b2b.tar.gz
git-ece43d9dc70b1717484ee78b66aef4f9390c2b2b.zip
object-file: introduce `struct odb_source_loose`
Currently, all state that relates to loose objects is held directly by the `struct odb_source`. Introduce a new `struct odb_source_loose` to hold the state instead so that it is entirely self-contained. This structure will eventually morph into the backend for accessing loose objects. As such, this is part of the refactorings to introduce pluggable object databases. 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.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/object-file.c b/object-file.c
index 4675c8ed6b..cd6aa561fa 100644
--- a/object-file.c
+++ b/object-file.c
@@ -1995,3 +1995,16 @@ void object_file_transaction_commit(struct odb_transaction *transaction)
transaction->odb->transaction = NULL;
free(transaction);
}
+
+struct odb_source_loose *odb_source_loose_new(struct odb_source *source)
+{
+ struct odb_source_loose *loose;
+ CALLOC_ARRAY(loose, 1);
+ loose->source = source;
+ return loose;
+}
+
+void odb_source_loose_free(struct odb_source_loose *loose)
+{
+ free(loose);
+}