repo: Make ostree_repo_create() nonfatal on existing repos

In general we want to support "idempotentcy" or "state
synchronization" across interruption.  If a repo is only partially
created due to a crash or whatever, it's hard for a user to know that.
Let's just make `ostree_repo_create()` idempotent. Since all we're
doing is a set of `mkdirat()` invocations, it's quite simple.

This also involved porting to fd-relative, which IMO makes the
code a lot clearer.

Closes: #422
Approved by: 14rcole
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2016-08-01 15:12:14 +00:00
1 parent a312d8fd8c
commit 5334758ba7
2 files changed
+60 -58

No files matched your search

+7 -1
View File
@@ -19,7 +19,7 @@
set -euo pipefail
echo "1..57"
echo "1..58"
$OSTREE checkout test2 checkout-test2
echo "ok checkout"
@@ -41,6 +41,12 @@ echo "ok shortened checksum"
(cd repo && ${CMD_PREFIX} ostree rev-parse test2)
echo "ok repo-in-cwd"
rm test-repo -rf
$OSTREE --repo=test-repo init --mode=bare-user
$OSTREE --repo=test-repo init --mode=bare-user
rm test-repo -rf
echo "ok repo-init on existing repo"
cd checkout-test2
assert_has_file firstfile
assert_has_file baz/cow