]> git.ipfire.org Git - thirdparty/git.git/commitdiff
odb/source-loose: stub out remaining callbacks
authorPatrick Steinhardt <ps@pks.im>
Thu, 21 May 2026 08:22:37 +0000 (10:22 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 May 2026 13:35:20 +0000 (22:35 +0900)
Stub out remaining callback functions for the "loose" backend.

Note that we also stub out transactions for loose objects. In fact, we
already have the infrastructure in place for those, and we could in
theory implement those, as well. But there are separate efforts ongoing
to polish up transactional interfaces, and doing so now would likely
result in some messiness. This omission will thus be worked on in a
subsequent patch series, once the dust has settled.

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

index e52fc289a24102431ea9e8b6040a2e3103da7c20..e17494131841601596431c5504b9ce0c4433ced1 100644 (file)
@@ -645,6 +645,25 @@ static int odb_source_loose_write_object_stream(struct odb_source *source,
        return odb_source_loose_write_stream(loose, in_stream, len, oid);
 }
 
+static int odb_source_loose_begin_transaction(struct odb_source *source UNUSED,
+                                             struct odb_transaction **out UNUSED)
+{
+       /* TODO: this is a known omission that we'll want to address eventually. */
+       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 int odb_source_loose_write_alternate(struct odb_source *source UNUSED,
+                                           const char *alternate UNUSED)
+{
+       return error("loose source does not support alternates");
+}
+
 static void odb_source_loose_clear_cache(struct odb_source_loose *loose)
 {
        oidtree_clear(loose->cache);
@@ -706,6 +725,9 @@ struct odb_source_loose *odb_source_loose_new(struct odb_source_files *files)
        loose->base.freshen_object = odb_source_loose_freshen_object;
        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;
+       loose->base.write_alternate = odb_source_loose_write_alternate;
 
        if (!is_absolute_path(loose->base.path))
                chdir_notify_register(NULL, odb_source_loose_reparent, loose);