lib/sysroot: Add non-failable ostree_sysroot_repo()

Having a failable accessor is annoying, since it's really common
to reference both.  Instead, open the repo once when we load
the sysroot, and provide a non-failable accessor.

This is also prep for `ostree_repo_open_at()`, which collapses the separation
between `ostree_repo_new()` and `ostree_repo_open()`.

Closes: #886
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-05-26 19:17:59 +00:00
1 parent ed430b45de
commit 9bf8a8503a
7 files changed
+47 -15

No files matched your search

+1 -5
View File
@@ -501,8 +501,6 @@ _ostree_sysroot_cleanup_internal (OstreeSysroot *self,
GCancellable *cancellable,
GError **error)
{
glnx_unref_object OstreeRepo *repo = NULL;
g_return_val_if_fail (OSTREE_IS_SYSROOT (self), FALSE);
g_return_val_if_fail (self->loaded, FALSE);
@@ -512,9 +510,7 @@ _ostree_sysroot_cleanup_internal (OstreeSysroot *self,
if (!cleanup_old_deployments (self, cancellable, error))
return FALSE;
if (!ostree_sysroot_get_repo (self, &repo, cancellable, error))
return FALSE;
OstreeRepo *repo = ostree_sysroot_repo (self);
if (!generate_deployment_refs (self, repo,
self->bootversion,
self->subbootversion,