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
+12 -33
+12 -33
View File
@@ -3598,23 +3598,12 @@ ostree_repo_import_object_from_with_trust (OstreeRepo *self,
&variant, error)) &variant, error))
return FALSE; return FALSE;
if (trusted) g_autofree guchar *real_csum = NULL;
{ if (!ostree_repo_write_metadata (self, objtype,
if (!ostree_repo_write_metadata_trusted (self, objtype, checksum, variant,
checksum, variant, trusted ? NULL : &real_csum,
cancellable, error)) cancellable, error))
return FALSE; return FALSE;
}
else
{
g_autofree guchar *real_csum = NULL;
if (!ostree_repo_write_metadata (self, objtype,
checksum, variant,
&real_csum,
cancellable, error))
return FALSE;
}
} }
else else
{ {
@@ -3627,22 +3616,12 @@ ostree_repo_import_object_from_with_trust (OstreeRepo *self,
cancellable, error)) cancellable, error))
return FALSE; return FALSE;
if (trusted) g_autofree guchar *real_csum = NULL;
{ if (!ostree_repo_write_content (self, checksum,
if (!ostree_repo_write_content_trusted (self, checksum, object_stream, length,
object_stream, length, trusted ? NULL : &real_csum,
cancellable, error)) cancellable, error))
return FALSE; return FALSE;
}
else
{
g_autofree guchar *real_csum = NULL;
if (!ostree_repo_write_content (self, checksum,
object_stream, length,
&real_csum,
cancellable, error))
return FALSE;
}
} }
return TRUE; return TRUE;