pull: don't use static deltas if archive repo

In https://github.com/ostreedev/ostree/pull/408, we disabled the use of
static deltas when mirroring. Later,
https://github.com/ostreedev/ostree/pull/506 loosened this up again so
that we could use static deltas when mirroring into bare{-user} repos.

However, the issue which originally spurrred #408 is even more generic
than that: we want to avoid static deltas for any archive repo, not just
when doing a mirror pull. This patch tightens this up, and also
relocates the decision code to make it easier to read.

Closes: #715
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon authored and Atomic Bot committed 2017-03-02 20:35:24 +00:00
1 parent 64422a7d0b
commit 199646ccfa
3 files changed
+32 -7

No files matched your search

+11 -1
View File
@@ -35,7 +35,7 @@ function verify_initial_contents() {
assert_file_has_content baz/cow '^moo$'
}
echo "1..14"
echo "1..15"
# Try both syntaxes
repo_init
@@ -69,6 +69,16 @@ ${CMD_PREFIX} ostree --repo=mirrorrepo pull --mirror origin main
${CMD_PREFIX} ostree --repo=mirrorrepo fsck
echo "ok pull mirror (should not apply deltas)"
cd ${test_tmpdir}
if ${CMD_PREFIX} ostree --repo=mirrorrepo \
pull origin main --require-static-deltas 2>err.txt; then
assert_not_reached "--require-static-deltas unexpectedly succeeded"
fi
assert_file_has_content err.txt "Can't use static deltas in an archive repo"
${CMD_PREFIX} ostree --repo=mirrorrepo pull origin main
${CMD_PREFIX} ostree --repo=mirrorrepo fsck
echo "ok pull (refuses deltas)"
cd ${test_tmpdir}
rm mirrorrepo/refs/remotes/* -rf
${CMD_PREFIX} ostree --repo=mirrorrepo prune --refs-only
+2 -2
View File
@@ -168,7 +168,7 @@ echo 'ok heuristic endian detection'
${CMD_PREFIX} ostree --repo=repo summary -u
mkdir repo2 && ${CMD_PREFIX} ostree --repo=repo2 init --mode=archive-z2
mkdir repo2 && ${CMD_PREFIX} ostree --repo=repo2 init --mode=bare-user
${CMD_PREFIX} ostree --repo=repo2 pull-local --require-static-deltas repo ${newrev}
${CMD_PREFIX} ostree --repo=repo2 fsck
${CMD_PREFIX} ostree --repo=repo2 ls ${newrev} >/dev/null
@@ -236,7 +236,7 @@ echo 'ok generate + show empty delta part'
${CMD_PREFIX} ostree --repo=repo summary -u
rm -rf repo2
mkdir repo2 && ${CMD_PREFIX} ostree --repo=repo2 init --mode=archive-z2
mkdir repo2 && ${CMD_PREFIX} ostree --repo=repo2 init --mode=bare-user
${CMD_PREFIX} ostree --repo=repo2 pull-local repo ${newrev}
${CMD_PREFIX} ostree --repo=repo2 pull-local --require-static-deltas repo ${samerev}
${CMD_PREFIX} ostree --repo=repo2 fsck