lib/checkout: For "process whiteouts" mode, replace directories too

I'm playing around with some ostree ⇔ OCI/Docker bits, and ran
into this while importing an OCI image that built from the Fedora
base image where `/home` is a regular directory, and I added a layer
that did the ostree bits of moving it to `/var` and leaving a symlink.

OCI/Docker supports this.  Now since "process whiteouts" is really the
"enable OCI/Docker" mode, let's only replace dirs if that's enabled.
This leaves the `UNION_FILES` targeted for its original use case
which is unioning components/packages.  (Although that use case itself
is now a bit superceded by `UNION_IDENTICAL`, but eh).

Closes: #1294
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-10-20 13:20:27 +00:00
1 parent 9166605e5a
commit b8251d26bd
3 files changed
+53 -5

No files matched your search

+14
View File
@@ -879,6 +879,20 @@ if touch overlay/baz/.wh.cow && touch overlay/.wh.deeper; then
assert_has_file overlay-co/anewdir/blah
assert_has_file overlay-co/anewfile
# And test replacing a directory wholesale with a symlink as well as a regular file
mkdir overlay
echo baz to file > overlay/baz
ln -s anewfile overlay/anewdir
$OSTREE --repo=repo commit ${COMMIT_ARGS} -b overlay-dir-convert --tree=dir=overlay
rm overlay -rf
rm overlay-co -rf
for branch in test2 overlay-dir-convert; do
$OSTREE --repo=repo checkout --union --whiteouts ${branch} overlay-co
done
assert_has_file overlay-co/baz
test -L overlay-co/anewdir
echo "ok whiteouts enabled"
# Now double check whiteouts are not processed without --whiteouts