daemon: make deploy work for local branches
We would unconditionally call ostree's pull() regardless of whether the branch we were tracking was remote or not. We need this to work to make it easier to write tests, though it's a worthy addition on its own. Closes: #371 Approved by: cgwalters
This commit is contained in:
parent
ff5dee43fb
commit
77acf62274
@ -284,18 +284,22 @@ rpmostreed_repo_pull_ancestry (OstreeRepo *repo,
|
|||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
/* Floating reference, transferred to dictionary. */
|
if (remote != NULL)
|
||||||
refs_value = g_variant_new_strv ((const char * const *) refs_array, -1);
|
{
|
||||||
|
/* Floating reference, transferred to dictionary. */
|
||||||
|
refs_value =
|
||||||
|
g_variant_new_strv ((const char * const *) refs_array, -1);
|
||||||
|
|
||||||
g_variant_dict_init (&options, NULL);
|
g_variant_dict_init (&options, NULL);
|
||||||
g_variant_dict_insert (&options, "depth", "i", depth);
|
g_variant_dict_insert (&options, "depth", "i", depth);
|
||||||
g_variant_dict_insert (&options, "flags", "i", flags);
|
g_variant_dict_insert (&options, "flags", "i", flags);
|
||||||
g_variant_dict_insert_value (&options, "refs", refs_value);
|
g_variant_dict_insert_value (&options, "refs", refs_value);
|
||||||
|
|
||||||
if (!ostree_repo_pull_with_options (repo, remote,
|
if (!ostree_repo_pull_with_options (repo, remote,
|
||||||
g_variant_dict_end (&options),
|
g_variant_dict_end (&options),
|
||||||
progress, cancellable, error))
|
progress, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
/* First pass only. Now we can resolve the ref to a checksum. */
|
/* First pass only. Now we can resolve the ref to a checksum. */
|
||||||
if (checksum == NULL)
|
if (checksum == NULL)
|
||||||
@ -304,26 +308,29 @@ rpmostreed_repo_pull_ancestry (OstreeRepo *repo,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If depth is negative (no visitor), this loop is skipped. */
|
if (visitor != NULL)
|
||||||
for (ii = 0; ii < depth && checksum != NULL; ii++)
|
|
||||||
{
|
{
|
||||||
g_autoptr(GVariant) commit = NULL;
|
for (ii = 0; ii < depth && checksum != NULL; ii++)
|
||||||
gboolean stop = FALSE;
|
{
|
||||||
|
g_autoptr(GVariant) commit = NULL;
|
||||||
|
gboolean stop = FALSE;
|
||||||
|
|
||||||
if (!ostree_repo_load_commit (repo, checksum, &commit, NULL, error))
|
if (!ostree_repo_load_commit (repo, checksum, &commit,
|
||||||
goto out;
|
NULL, error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
if (!visitor (repo, checksum, commit, visitor_data, &stop, error))
|
if (!visitor (repo, checksum, commit, visitor_data, &stop, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
g_clear_pointer (&checksum, g_free);
|
g_clear_pointer (&checksum, g_free);
|
||||||
|
|
||||||
if (!stop)
|
if (!stop)
|
||||||
checksum = ostree_commit_get_parent (commit);
|
checksum = ostree_commit_get_parent (commit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Break if no visitor, or visitor told us to stop. */
|
/* Break if no visitor, or visitor told us to stop. */
|
||||||
if (depth < 0 || checksum == NULL)
|
if (visitor == NULL || checksum == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Pull the next batch of commits, twice as many. */
|
/* Pull the next batch of commits, twice as many. */
|
||||||
|
Loading…
Reference in New Issue
Block a user