summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYu Qi Zhang <jzehrarnyg@gmail.com>2016-06-20 20:20:58 +0000
committerAtomic Bot <atomic-devel@projectatomic.io>2016-06-21 20:20:15 +0000
commit744543110e3d12464a752d59956dc24a0f99b1d2 (patch)
tree13b39a275a2130dad7ae4f5654e66ca2c0a9eeaa /tests
parentf6ce04e4807c2934a5aba5522201998c815c7233 (diff)
downloadostree-744543110e3d12464a752d59956dc24a0f99b1d2.tar.gz
refs: allow overwrite of empty folders
We noticed that once a ref folder is created, there is no existing command that can remove it. For example, once "foo/bar" is created, even if the user deletes foo or all the refs under foo, the folder will persist. Now when the user attempts to create a ref "foo" either through commit or refs --create, if a folder "foo" exists but is empty of refs, the folder is removed and the new ref "foo" is created. New unit tests in tests-ref.sh verify this functionality. Closes: #354 Approved by: cgwalters
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test-refs.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/test-refs.sh b/tests/test-refs.sh
index 3d229031..310b586f 100755
--- a/tests/test-refs.sh
+++ b/tests/test-refs.sh
@@ -92,8 +92,16 @@ fi
${CMD_PREFIX} ostree --repo=repo refs | wc -l > refscount.create1
assert_file_has_content refscount.create1 "^5$"
-${CMD_PREFIX} ostree --repo=repo refs ctest --create ctest-new
+${CMD_PREFIX} ostree --repo=repo refs ctest --create=ctest-new
${CMD_PREFIX} ostree --repo=repo refs | wc -l > refscount.create2
assert_file_has_content refscount.create2 "^6$"
+#Check to see if a deleted folder can be re-used as the name of a ref
+${CMD_PREFIX} ostree --repo=repo refs foo/ctest --delete
+${CMD_PREFIX} ostree --repo=repo refs | wc -l > refscount.create3
+assert_file_has_content refscount.create3 "^5$"
+${CMD_PREFIX} ostree --repo=repo refs ctest --create=foo
+${CMD_PREFIX} ostree --repo=repo refs | wc -l > refscount.create4
+assert_file_has_content refscount.create4 "^6$"
+
echo "ok refs"