From 01a68e697b1f78d6dacbbc8ecda464e2bdda6f14 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 24 Oct 2016 14:33:02 +0200 Subject: [PATCH] Work around ostree partial commit issue This works around: https://github.com/ostreedev/ostree/issues/541 Which is causing us to not pull the entire set of objects, rather stopping at the first object which is locally available. We fix this by pulling twice in the subdirs != NULL case, which works because the second time the new commit is marked partial and we then pull the entire thing. --- common/flatpak-dir.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 08aed51e..3e870403 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -1267,6 +1267,7 @@ repo_pull_one_dir (OstreeRepo *self, { GVariantBuilder builder; gboolean force_disable_deltas = FALSE; + g_autoptr(GVariant) options = NULL; const char *refs_to_fetch[2]; const char *revs_to_fetch[2]; gboolean res; @@ -1300,8 +1301,21 @@ repo_pull_one_dir (OstreeRepo *self, g_variant_builder_add (&builder, "{s@v}", "override-commit-ids", g_variant_new_variant (g_variant_new_strv ((const char * const *) revs_to_fetch, -1))); - res = ostree_repo_pull_with_options (self, remote_name, g_variant_builder_end (&builder), + options = g_variant_ref_sink (g_variant_builder_end (&builder)); + res = ostree_repo_pull_with_options (self, remote_name, options, progress, cancellable, error); + if (res && dirs_to_pull != NULL) + { + /* This works around an issue with ostree where it doesn't pull + * all dependencies (stops are first locally available object) + * unless the commit itself is a commitpartial: + * https://github.com/ostreedev/ostree/issues/543 + * The workaround works by pulling again, and on the new pull + * the commit *will* have a commitpartial. + */ + res = ostree_repo_pull_with_options (self, remote_name, options, + progress, cancellable, error); + } return res; }