lib: Change read_commit_detached_metadata to be nullable
authorColin Walters <walters@verbum.org>
Wed, 25 Aug 2021 19:18:43 +0000 (15:18 -0400)
committerColin Walters <walters@verbum.org>
Thu, 26 Aug 2021 01:29:51 +0000 (21:29 -0400)
Hit this while working on some Rust code.

src/libostree/ostree-repo-commit.c

index d5ab57a2f5c488d2073faef708ea3b56d624731f..8dc2355e9e6511a3915e9efe102c736c1cea7600 100644 (file)
@@ -3117,7 +3117,7 @@ ostree_repo_write_commit_with_time (OstreeRepo      *self,
  * ostree_repo_read_commit_detached_metadata:
  * @self: Repo
  * @checksum: ASCII SHA256 commit checksum
- * @out_metadata: (out) (transfer full): Metadata associated with commit in with format "a{sv}", or %NULL if none exists
+ * @out_metadata: (out) (nullable) (transfer full): Metadata associated with commit in with format "a{sv}", or %NULL if none exists
  * @cancellable: Cancellable
  * @error: Error
  *
@@ -3132,6 +3132,8 @@ ostree_repo_read_commit_detached_metadata (OstreeRepo      *self,
                                            GCancellable    *cancellable,
                                            GError         **error)
 {
+  g_assert (out_metadata != NULL);
+
   char buf[_OSTREE_LOOSE_PATH_MAX];
   _ostree_loose_path (buf, checksum, OSTREE_OBJECT_TYPE_COMMIT_META, self->mode);