repo: Don't put remote refs in the summary file

I was doing a chain of mirroring like A -> B -> C

And repo B had A as a remote.  When I added B as
a remote to C, the summary file of B had a ref
upstream:foo/bar/baz, which caused all pulls from
B to C to fail, since the summary file is only
expected to have refs, not refspecs.

Closes: https://github.com/ostreedev/ostree/issues/561

Closes: #565
Approved by: jlebon
This commit is contained in:
Colin Walters 2016-11-01 14:17:57 -04:00 committed by Atomic Bot
parent f0e493bf29
commit 730f723869
1 changed files with 8 additions and 0 deletions

View File

@ -4668,10 +4668,18 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
{ {
const char *ref = iter->data; const char *ref = iter->data;
const char *commit = g_hash_table_lookup (refs, ref); const char *commit = g_hash_table_lookup (refs, ref);
g_autofree char *remotename = NULL;
g_autoptr(GVariant) commit_obj = NULL; g_autoptr(GVariant) commit_obj = NULL;
g_assert (commit); g_assert (commit);
if (!ostree_parse_refspec (ref, &remotename, NULL, NULL))
g_assert_not_reached ();
/* Don't put remote refs in the summary */
if (remotename != NULL)
continue;
if (!ostree_repo_load_variant (self, OSTREE_OBJECT_TYPE_COMMIT, commit, &commit_obj, error)) if (!ostree_repo_load_variant (self, OSTREE_OBJECT_TYPE_COMMIT, commit, &commit_obj, error))
goto out; goto out;