diff options
author | Colin Walters <walters@verbum.org> | 2017-07-04 06:55:51 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-07-05 13:37:22 +0000 |
commit | 3234295324fe63f488cc68632066a784d4d11f53 (patch) | |
tree | 78c4c707e5cf1ff62e56154a42146e7932300807 /tests/pull-test.sh | |
parent | 1f5ce1a9f789d9c0de5d6fbdf79540bf71c5bc9b (diff) | |
download | ostree-3234295324fe63f488cc68632066a784d4d11f53.tar.gz |
pull: Cleanly error when doing local pulls of remote-prefixed refs
In the storage PR I was trying to do a `pull-local` of the whole
`/ostree/repo` on the system, which ended up triggering a `g_critical()`
in the collections code, since we tried to parse a remote-prefixed ref
`fedora:fedora/26/x86_64/atomic-host` as a ref.
I'm not sure offhand what our behavior in this case *should* be. I
think git only clones local refs, but I need to check.
This corner case arises only with `pull-local`. But in any case,
while we were previously saying this is programmer error, since it's
so easy to pass various unchecked input into the pull machinery,
make invalid refs an explicit error.
Closes: #992
Approved by: jlebon
Diffstat (limited to 'tests/pull-test.sh')
-rw-r--r-- | tests/pull-test.sh | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/pull-test.sh b/tests/pull-test.sh index 1da0fa4c..aaba2a7b 100644 --- a/tests/pull-test.sh +++ b/tests/pull-test.sh @@ -35,7 +35,7 @@ function verify_initial_contents() { assert_file_has_content baz/cow '^moo$' } -echo "1..25" +echo "1..26" # Try both syntaxes repo_init --no-gpg-verify @@ -162,6 +162,26 @@ $OSTREE show main >/dev/null echo "ok pull local mirror" cd ${test_tmpdir} +# This is more of a known issue; test that we give a clean error right now +rm otherrepo -rf +ostree_repo_init otherrepo --mode=archive +rm checkout-origin-main -rf +${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo checkout main checkout-origin-main +${CMD_PREFIX} ostree --repo=otherrepo commit -b localbranch --tree=dir=checkout-origin-main +${CMD_PREFIX} ostree --repo=otherrepo remote add --set=gpg-verify=false origin file://$(pwd)/ostree-srv/gnomerepo +${CMD_PREFIX} ostree --repo=otherrepo pull origin main +rm mirrorrepo-local -rf +ostree_repo_init mirrorrepo-local --mode=archive +if ${CMD_PREFIX} ostree --repo=mirrorrepo-local pull-local otherrepo 2>err.txt; then + fatal "pull with mixed refs succeeded?" +fi +assert_file_has_content err.txt "error: Invalid ref name origin:main" +${CMD_PREFIX} ostree --repo=mirrorrepo-local pull-local otherrepo localbranch +${CMD_PREFIX} ostree --repo=mirrorrepo-local rev-parse localbranch +${CMD_PREFIX} ostree --repo=mirrorrepo-local fsck +echo "ok pull-local mirror errors with mixed refs" + +cd ${test_tmpdir} ${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit -b main -s "Metadata string" --add-detached-metadata-string=SIGNATURE=HANCOCK --tree=ref=main ${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u ${CMD_PREFIX} ostree --repo=repo pull origin main |