Add ostree_commit_get_parent() to get parent from variant
https://bugzilla.gnome.org/show_bug.cgi?id=705973
This commit is contained in:
parent
790132a81a
commit
5efb8e86e9
|
|
@ -1643,3 +1643,13 @@ ostree_validate_structureof_dirmeta (GVariant *dirmeta,
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gchar *
|
||||||
|
ostree_commit_get_parent (GVariant *commit_variant)
|
||||||
|
{
|
||||||
|
gs_unref_variant GVariant *bytes = NULL;
|
||||||
|
bytes = g_variant_get_child_value (commit_variant, 1);
|
||||||
|
if (g_variant_n_children (bytes) == 0)
|
||||||
|
return NULL;
|
||||||
|
return ostree_checksum_from_bytes_v (bytes);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -319,5 +319,6 @@ gboolean ostree_validate_structureof_dirtree (GVariant *index,
|
||||||
gboolean ostree_validate_structureof_dirmeta (GVariant *index,
|
gboolean ostree_validate_structureof_dirmeta (GVariant *index,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
gchar * ostree_commit_get_parent (GVariant *commit_variant);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
||||||
|
|
@ -211,12 +211,10 @@ ostree_repo_traverse_commit (OstreeRepo *repo,
|
||||||
|
|
||||||
if (maxdepth == -1 || maxdepth > 0)
|
if (maxdepth == -1 || maxdepth > 0)
|
||||||
{
|
{
|
||||||
g_variant_get_child (commit, 1, "@ay", &parent_csum_bytes);
|
g_free (tmp_checksum);
|
||||||
|
tmp_checksum = ostree_commit_get_parent (commit);
|
||||||
if (g_variant_n_children (parent_csum_bytes) > 0)
|
if (tmp_checksum)
|
||||||
{
|
{
|
||||||
g_free (tmp_checksum);
|
|
||||||
tmp_checksum = ostree_checksum_from_bytes_v (parent_csum_bytes);
|
|
||||||
commit_checksum = tmp_checksum;
|
commit_checksum = tmp_checksum;
|
||||||
if (maxdepth > 0)
|
if (maxdepth > 0)
|
||||||
maxdepth -= 1;
|
maxdepth -= 1;
|
||||||
|
|
@ -231,4 +229,3 @@ ostree_repo_traverse_commit (OstreeRepo *repo,
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue