diff options
author | Alexander Larsson <alexl@redhat.com> | 2016-10-24 11:12:15 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2016-10-24 17:48:19 +0000 |
commit | d0e74cf3af73d6855eebe9c52f19105f7c84df0a (patch) | |
tree | 367b976fe0e4728c2f50e035accddab311082f5b /src/libostree/ostree-repo-prune.c | |
parent | d3f14f02e3d9f7259c7ec6b25980ae43f03c4906 (diff) | |
download | ostree-d0e74cf3af73d6855eebe9c52f19105f7c84df0a.tar.gz |
Fix pruning of partial commits
If we have a partial commit it is not an error for a dirmeta to be
missing (in fact, that is likely), so instead of returning a not-found
error from ostree_repo_traverse_commit() we ignore the error and
continue.
In particular, this means we don't stop early at the first
missing dirmeta, which previously caused ostree_repo_prune() to
thing the dirmetas after that to be unreached and thus purged.
Also, we remove the special casing in ostree_repo_prune() to
not report errors for commitpartial, because these should not
be reported anymore.
This fixes https://github.com/ostreedev/ostree/issues/541
Closes: #542
Approved by: cgwalters
Diffstat (limited to 'src/libostree/ostree-repo-prune.c')
-rw-r--r-- | src/libostree/ostree-repo-prune.c | 44 |
1 files changed, 4 insertions, 40 deletions
diff --git a/src/libostree/ostree-repo-prune.c b/src/libostree/ostree-repo-prune.c index 66170d4d..22bff915 100644 --- a/src/libostree/ostree-repo-prune.c +++ b/src/libostree/ostree-repo-prune.c @@ -311,29 +311,11 @@ ostree_repo_prune (OstreeRepo *self, while (g_hash_table_iter_next (&hash_iter, &key, &value)) { const char *checksum = value; - OstreeRepoCommitState commitstate; - GError *local_error = NULL; - - if (!ostree_repo_load_commit (self, checksum, NULL, &commitstate, - error)) - goto out; g_debug ("Finding objects to keep for commit %s", checksum); if (!ostree_repo_traverse_commit_union (self, checksum, depth, data.reachable, - cancellable, &local_error)) - { - /* Don't fail traversing a partial commit */ - if ((commitstate & OSTREE_REPO_COMMIT_STATE_PARTIAL) > 0 && - g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) - { - g_clear_error (&local_error); - } - else - { - g_propagate_error (error, local_error); - goto out; - } - } + cancellable, error)) + goto out; } } @@ -349,34 +331,16 @@ ostree_repo_prune (OstreeRepo *self, GVariant *serialized_key = key; const char *checksum; OstreeObjectType objtype; - OstreeRepoCommitState commitstate; - GError *local_error = NULL; ostree_object_name_deserialize (serialized_key, &checksum, &objtype); if (objtype != OSTREE_OBJECT_TYPE_COMMIT) continue; - if (!ostree_repo_load_commit (self, checksum, NULL, &commitstate, - error)) - goto out; - g_debug ("Finding objects to keep for commit %s", checksum); if (!ostree_repo_traverse_commit_union (self, checksum, depth, data.reachable, - cancellable, &local_error)) - { - /* Don't fail traversing a partial commit */ - if ((commitstate & OSTREE_REPO_COMMIT_STATE_PARTIAL) > 0 && - g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) - { - g_clear_error (&local_error); - } - else - { - g_propagate_error (error, local_error); - goto out; - } - } + cancellable, error)) + goto out; } } |