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
This commit is contained in:
Alexander Larsson authored and Atomic Bot committed 2016-10-24 17:48:19 +00:00
1 parent d3f14f02e3
commit d0e74cf3af
3 files changed
+77 -52

No files matched your search

+23 -2
View File
@@ -23,7 +23,7 @@ set -euo pipefail
setup_fake_remote_repo1 "archive-z2"
echo '1..2'
echo '1..4'
repopath=${test_tmpdir}/ostree-srv/gnomerepo
cp -a ${repopath} ${repopath}.orig
@@ -54,5 +54,26 @@ ${CMD_PREFIX} ostree --repo=repo ls origin:main /firstfile
${CMD_PREFIX} ostree --repo=repo pull origin main
assert_not_has_file repo/state/${rev}.commitpartial
${CMD_PREFIX} ostree --repo=repo fsck
echo "ok"
echo "ok subpaths"
rm -rf repo
${CMD_PREFIX} ostree --repo=repo init
${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin ${remoteurl}
# Pull a directory which is not the first in the commit (/baz/another is before)
${CMD_PREFIX} ostree --repo=repo pull --subpath=/baz/deeper origin main
# Ensure it is there
${CMD_PREFIX} ostree --repo=repo ls origin:main /baz/deeper
# Now prune, this should not prune the /baz/deeper dirmeta even if the
# /baz/another dirmeta is not in the repo.
${CMD_PREFIX} ostree --repo=repo prune --refs-only
# Ensure it is still there
${CMD_PREFIX} ostree --repo=repo ls origin:main /baz/deeper
echo "ok prune with commitpartial"
done