lib/pull: Minor refactoring of metadata scanning function
Make the "local repo" processing conditional the same as the "localcache" bits; this is really just a de-indent. Also add some comments. Prep for further work. Closes: #1212 Approved by: jlebon
This commit is contained in:
parent
d0d27288da
commit
72ddd4f419
|
|
@ -1749,18 +1749,20 @@ scan_one_metadata_object_c (OtPullData *pull_data,
|
|||
g_autofree char *tmp_checksum = ostree_checksum_from_bytes (csum);
|
||||
g_autoptr(GVariant) object = ostree_object_name_serialize (tmp_checksum, objtype);
|
||||
|
||||
/* It may happen that we've already looked at this object (think shared
|
||||
* dirtree subtrees), if that's the case, we're done */
|
||||
if (g_hash_table_lookup (pull_data->scanned_metadata, object))
|
||||
return TRUE;
|
||||
|
||||
gboolean is_requested = g_hash_table_lookup (pull_data->requested_metadata, object) != NULL;
|
||||
/* Determine if we already have the object */
|
||||
gboolean is_stored;
|
||||
if (!ostree_repo_has_object (pull_data->repo, objtype, tmp_checksum, &is_stored,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (pull_data->remote_repo_local)
|
||||
{
|
||||
if (!is_stored)
|
||||
/* Are we pulling an object we don't have from a local repo? */
|
||||
if (!is_stored && pull_data->remote_repo_local)
|
||||
{
|
||||
if (objtype == OSTREE_OBJECT_TYPE_COMMIT)
|
||||
{
|
||||
|
|
@ -1777,7 +1779,6 @@ scan_one_metadata_object_c (OtPullData *pull_data,
|
|||
*/
|
||||
if (objtype == OSTREE_OBJECT_TYPE_COMMIT)
|
||||
g_hash_table_add (pull_data->fetched_detached_metadata, g_strdup (tmp_checksum));
|
||||
}
|
||||
is_stored = TRUE;
|
||||
is_requested = TRUE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue