lib/repo: Minor cleanup to object import function

We have a lot of layers of abstraction here; let's fold in the `trusted`
conditional into the call, since that's all the public API we're using does
anyways.

Prep for a future patch around object copying during imports.

Closes: #1187
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-09-19 18:51:03 +00:00
1 parent 223c940b46
commit 3e564116b2
1 file changed
+2 -23
+2 -23
View File
@@ -3598,24 +3598,13 @@ ostree_repo_import_object_from_with_trust (OstreeRepo *self,
&variant, error)) &variant, error))
return FALSE; return FALSE;
if (trusted)
{
if (!ostree_repo_write_metadata_trusted (self, objtype,
checksum, variant,
cancellable, error))
return FALSE;
}
else
{
g_autofree guchar *real_csum = NULL; g_autofree guchar *real_csum = NULL;
if (!ostree_repo_write_metadata (self, objtype, if (!ostree_repo_write_metadata (self, objtype,
checksum, variant, checksum, variant,
&real_csum, trusted ? NULL : &real_csum,
cancellable, error)) cancellable, error))
return FALSE; return FALSE;
} }
}
else else
{ {
/* Content object */ /* Content object */
@@ -3627,23 +3616,13 @@ ostree_repo_import_object_from_with_trust (OstreeRepo *self,
cancellable, error)) cancellable, error))
return FALSE; return FALSE;
if (trusted)
{
if (!ostree_repo_write_content_trusted (self, checksum,
object_stream, length,
cancellable, error))
return FALSE;
}
else
{
g_autofree guchar *real_csum = NULL; g_autofree guchar *real_csum = NULL;
if (!ostree_repo_write_content (self, checksum, if (!ostree_repo_write_content (self, checksum,
object_stream, length, object_stream, length,
&real_csum, trusted ? NULL : &real_csum,
cancellable, error)) cancellable, error))
return FALSE; return FALSE;
} }
}
return TRUE; return TRUE;
} }