Skip to content

Commit

Permalink
fixup! deployment: add ostree_deployment_get_version API
Browse files Browse the repository at this point in the history
Just some code reorg
  • Loading branch information
r4f4 committed Jan 27, 2020
1 parent 5df4486 commit a4d7b33
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/libostree/ostree-deployment.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,15 @@ _ostree_deployment_get_version (OstreeDeployment *self,
/* Try extracting a version for this deployment. */
const gchar *csum = ostree_deployment_get_csum (self);

gchar *version = NULL;
g_autoptr(GVariant) variant = NULL;
if (ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, csum,
&variant, error))
{
g_autoptr(GVariant) metadata = g_variant_get_child_value (variant, 0);
g_variant_lookup (metadata, OSTREE_COMMIT_META_KEY_VERSION, "s", &version);
}
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, csum,
&variant, error))
return NULL;

self->version = version;
g_autoptr(GVariant) metadata = g_variant_get_child_value (variant, 0);
g_variant_lookup (metadata, OSTREE_COMMIT_META_KEY_VERSION, "s", &self->version);

return version;
return self->version;
}

/**
Expand Down

0 comments on commit a4d7b33

Please sign in to comment.