{
OstreeRepoFinderResult *result = g_ptr_array_index (results, i);
g_autoptr(GHashTable) validated_ref_to_checksum = NULL; /* (element-type utf8 utf8) */
- gsize j;
+ gsize j, n_latest_refs;
/* Previous error processing this result? */
if (result == NULL)
ostree_collection_ref_equal,
(GDestroyNotify) ostree_collection_ref_free,
g_free);
+ n_latest_refs = 0;
for (j = 0; refs[j] != NULL; j++)
{
if (pointer_table_get (refs_and_remotes_table, j, i) != latest_commit_for_ref)
latest_commit_for_ref = NULL;
+ if (latest_commit_for_ref != NULL)
+ n_latest_refs++;
g_hash_table_insert (validated_ref_to_checksum, ostree_collection_ref_dup (refs[j]), g_strdup (latest_commit_for_ref));
}
- if (g_hash_table_size (validated_ref_to_checksum) == 0)
+ if (n_latest_refs == 0)
{
g_debug ("%s: Omitting remote ‘%s’ from results as none of its refs are new enough.",
G_STRFUNC, result->remote->name);
${CMD_PREFIX} ostree --repo=local-mirror refs | wc -l > refscount
assert_file_has_content refscount "^0$"
+ls -1 local-mirror/refs/remotes | wc -l > remotescount
+assert_file_has_content remotescount "^0$"
${CMD_PREFIX} ostree --repo=local-mirror refs --collections > refs
assert_file_has_content refs "^(org.example.AppsCollection, app1)$"
assert_file_has_content refs "^(org.example.OsCollection, os/amd64/master)$"
+assert_file_has_content local-mirror/refs/mirrors/org.example.AppsCollection/app1 "^$(cat app1-checksum)$"
+assert_file_has_content local-mirror/refs/mirrors/org.example.OsCollection/os/amd64/master "^$(cat os-checksum)$"
+
for repo in local local-mirror; do
# Try finding an update for an existing branch.
${CMD_PREFIX} ostree --repo=$repo find-remotes org.example.AppsCollection app1 > find
assert_file_has_content pull "^Pulled 1/1 refs successfully.$"
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
assert_ref $repo os/amd64/master $(cat os-checksum-2)
+
+ # We need to manually update the refs afterwards, since the original pull
+ # into the local-mirror was a --mirror pull — so it wrote refs/mirrors/blah.
+ # This pull was not, so it wrote refs/remotes/blah.
+ ${CMD_PREFIX} ostree --repo=$repo refs --collections --create org.example.OsCollection:os/amd64/master os-remote:os/amd64/master
done
# Add the local mirror to the local repository as a remote, so that the local repo
# has two configured remotes for the os-collection. Ensure its summary is up to date first.
-#${CMD_PREFIX} ostree --repo=local-mirror summary --update
-# FIXME: This `cp` can be changed to `ostree summary --update` once PR #946 lands.
-# Prior to that, we need to preserve the signatures.
-cp os-collection/summary{,.sig} local-mirror/
+${CMD_PREFIX} ostree --repo=local-mirror summary --update
${CMD_PREFIX} ostree --repo=local remote add os-remote-local-mirror file://$(pwd)/local-mirror --collection-id org.example.OsCollection --gpg-import=${test_tmpdir}/gpghome/key2.asc
for repo in local; do
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$"
assert_file_has_content find "^ - Keyring: os-remote.trustedkeys.gpg$"
assert_file_has_content find "^ - (org.example.OsCollection, os/amd64/master) = $(cat os-checksum-3)$"
- assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/local-mirror$"
- assert_file_has_content find "^ - Keyring: os-remote-local-mirror.trustedkeys.gpg$"
- assert_file_has_content find "^ - (org.example.OsCollection, os/amd64/master) = $(cat os-checksum-3)$"
assert_file_has_content find "^1/1 refs were found.$"
assert_not_file_has_content find "^No results.$"