lib/repo-refs: Add ostree_repo_remote_list_collection_refs() API

This parallels ostree_repo_remote_list_refs(), but returns a map of
OstreeCollectionRef → checksum, and includes refs from collection IDs
other than the remote repository’s main collection ID.

Use this in OstreeRepoFinderConfig to ensure that refs are matched
against even if they’re stored in the repository summary file’s
collection map, rather than its main ref map. This fixes false negatives
when searching for refs in some situations.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1058
Approved by: cgwalters
This commit is contained in:
Philip Withnall authored and Atomic Bot committed 2017-08-08 13:59:58 +00:00
1 parent 11e165b154
commit f35b409077
5 files changed
+136 -4

No files matched your search

+5 -4
View File
@@ -111,7 +111,7 @@ ostree_repo_finder_config_resolve_async (OstreeRepoFinder *find
for (i = 0; i < n_remotes; i++)
{
g_autoptr(GError) local_error = NULL;
g_autoptr(GHashTable) remote_refs = NULL; /* (element-type utf8 utf8) */
g_autoptr(GHashTable) remote_refs = NULL; /* (element-type OstreeCollectionRef utf8) */
const gchar *checksum;
g_autofree gchar *remote_collection_id = NULL;
@@ -127,8 +127,9 @@ ostree_repo_finder_config_resolve_async (OstreeRepoFinder *find
continue;
}
if (!ostree_repo_remote_list_refs (parent_repo, remote_name, &remote_refs,
cancellable, &local_error))
if (!ostree_repo_remote_list_collection_refs (parent_repo, remote_name,
&remote_refs, cancellable,
&local_error))
{
g_debug ("Ignoring remote ‘%s’ due to error loading its refs: %s",
remote_name, local_error->message);
@@ -139,7 +140,7 @@ ostree_repo_finder_config_resolve_async (OstreeRepoFinder *find
for (j = 0; refs[j] != NULL; j++)
{
if (g_strcmp0 (refs[j]->collection_id, remote_collection_id) == 0 &&
g_hash_table_lookup_extended (remote_refs, refs[j]->ref_name, NULL, (gpointer *) &checksum))
g_hash_table_lookup_extended (remote_refs, refs[j], NULL, (gpointer *) &checksum))
{
/* The requested ref is listed in the refs for this remote. Add
* the remote to the results, and the ref to its