diff options
author | Dan Nicholson <nicholson@endlessm.com> | 2019-06-10 09:47:44 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2019-06-12 15:00:19 +0000 |
commit | d916383953121f7bbd016a977caf85bc6f917422 (patch) | |
tree | 92ea9eefbeb4d0d78696eb602ff273df5e449bc5 /tests/test-refs.sh | |
parent | 6733843f87aa3b1ad3dfe1ae76f0c76329617909 (diff) | |
download | ostree-d916383953121f7bbd016a977caf85bc6f917422.tar.gz |
bin/refs: Allow overwriting existing ref
Currently if you want to update a non-alias ref, you need to first check
if it exists and use either `ostree refs --create` or `ostree reset` as
appropriate. That's unnecessarily complicated and is much less
convenient than the old `write-refs` builtin that simply called
`ostree_repo_set_ref_immediate()` without any checks.
Add a `--force` option to be used with `--create` that does not raise an
error when the destination ref already exists.
Closes: #1870
Approved by: jlebon
Diffstat (limited to 'tests/test-refs.sh')
-rwxr-xr-x | tests/test-refs.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test-refs.sh b/tests/test-refs.sh index 83da04ff..d0f8e7da 100755 --- a/tests/test-refs.sh +++ b/tests/test-refs.sh @@ -90,6 +90,11 @@ if ${CMD_PREFIX} ostree --repo=repo refs foo/ctest --create=ctest; then assert_not_reached "refs --create unexpectedly succeeded in overwriting an existing prefix!" fi +# Force overwriting ctest and check the revision got updated +foo_ctest_rev=$(${CMD_PREFIX} ostree --repo=repo rev-parse foo/ctest) +${CMD_PREFIX} ostree --repo=repo refs foo/ctest --create=ctest --force +assert_ref repo ctest ${foo_ctest_rev} + # https://github.com/ostreedev/ostree/issues/1285 # One tool was creating .latest_rsync files in each dir, let's ignore stuff like # that. |