]> git.ipfire.org Git - thirdparty/git.git/commitdiff
odb/source-loose: wire up `close()` callback
authorPatrick Steinhardt <ps@pks.im>
Thu, 21 May 2026 08:22:25 +0000 (10:22 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 May 2026 13:35:19 +0000 (22:35 +0900)
Wire up a new `close()` callback for the loose source and call it from
the "files" source via the generic `odb_source_close()` interface. The
callback itself is a no-op as the loose source has no resources that
need to be released on close.

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

index 10832e81e4e206f8479b45761cb9e60637c05d62..59e3a70d80d3554624437bf93955c5dec3d6268a 100644 (file)
@@ -36,6 +36,7 @@ static void odb_source_files_free(struct odb_source *source)
 static void odb_source_files_close(struct odb_source *source)
 {
        struct odb_source_files *files = odb_source_files_downcast(source);
+       odb_source_close(&files->loose->base);
        packfile_store_close(files->packed);
 }
 
index e0fe0d513d253222f76c32158ef134f826a380f3..65c1076659b8fd95341ca6b3203724eb1716c76e 100644 (file)
@@ -21,6 +21,11 @@ static void odb_source_loose_reprepare(struct odb_source *source)
        odb_source_loose_clear_cache(loose);
 }
 
+static void odb_source_loose_close(struct odb_source *source UNUSED)
+{
+       /* Nothing to do. */
+}
+
 static void odb_source_loose_reparent(const char *name UNUSED,
                                      const char *old_cwd,
                                      const char *new_cwd,
@@ -53,6 +58,7 @@ struct odb_source_loose *odb_source_loose_new(struct odb_source_files *files)
        loose->files = files;
 
        loose->base.free = odb_source_loose_free;
+       loose->base.close = odb_source_loose_close;
        loose->base.reprepare = odb_source_loose_reprepare;
 
        if (!is_absolute_path(loose->base.path))