fsck: Use `load_variant_if_exists`
This cleans up error handling here.
This commit is contained in:
parent
bd030a96f2
commit
436ff11a00
|
|
@ -298,25 +298,15 @@ fsck_one_commit (OstreeRepo *repo, const char *checksum, GVariant *commit, GPtrA
|
||||||
|
|
||||||
if (opt_add_tombstones)
|
if (opt_add_tombstones)
|
||||||
{
|
{
|
||||||
GError *local_error = NULL;
|
|
||||||
g_autofree char *parent = ostree_commit_get_parent (commit);
|
g_autofree char *parent = ostree_commit_get_parent (commit);
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
g_autoptr(GVariant) parent_commit = NULL;
|
g_autoptr(GVariant) parent_commit = NULL;
|
||||||
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, parent,
|
if (!ostree_repo_load_variant_if_exists (repo, OSTREE_OBJECT_TYPE_COMMIT, parent,
|
||||||
&parent_commit, &local_error))
|
&parent_commit, error))
|
||||||
{
|
return FALSE;
|
||||||
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
if (!parent_commit)
|
||||||
{
|
g_ptr_array_add (tombstones, g_strdup (checksum));
|
||||||
g_ptr_array_add (tombstones, g_strdup (checksum));
|
|
||||||
g_clear_error (&local_error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_propagate_error (error, local_error);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue