odb/source-loose: stub out remaining callbacks
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>
Patrick Steinhardt committed
Jun 1, 2026 at 10:20 UTC
87af3bb434b86805f69fae40c966d92db1bd2eae
1 file changed
+22
odb/source-loose.c
+22
@@ -645,6 +645,25 @@ static int odb_source_loose_write_object_stream(struct odb_source *source,
645
return odb_source_loose_write_stream(loose, in_stream, len, oid);
646
}
647
648
+static int odb_source_loose_begin_transaction(struct odb_source *source UNUSED,
649
+ struct odb_transaction **out UNUSED)
650
+{
651
+ /* TODO: this is a known omission that we'll want to address eventually. */
652
+ return error("loose source does not support transactions");
653
+}
654
+
655
+static int odb_source_loose_read_alternates(struct odb_source *source UNUSED,
656
+ struct strvec *out UNUSED)
657
+{
658
+ return 0;
659
+}
660
+
661
+static int odb_source_loose_write_alternate(struct odb_source *source UNUSED,
662
+ const char *alternate UNUSED)
663
+{
664
+ return error("loose source does not support alternates");
665
+}
666
+
667
static void odb_source_loose_clear_cache(struct odb_source_loose *loose)
668
{
669
oidtree_clear(loose->cache);
@@ -706,6 +725,9 @@ struct odb_source_loose *odb_source_loose_new(struct odb_source_files *files)
725
loose->base.freshen_object = odb_source_loose_freshen_object;
726
loose->base.write_object = odb_source_loose_write_object;
727
loose->base.write_object_stream = odb_source_loose_write_object_stream;
728
+ loose->base.begin_transaction = odb_source_loose_begin_transaction;
729
+ loose->base.read_alternates = odb_source_loose_read_alternates;
730
+ loose->base.write_alternate = odb_source_loose_write_alternate;
731
732
if (!is_absolute_path(loose->base.path))
733
chdir_notify_register(NULL, odb_source_loose_reparent, loose);