summaryrefslogtreecommitdiff
path: root/tests/basic-test.sh
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2018-10-11 14:35:23 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-10-11 20:49:54 +0000
commit9367a1befe045663a69265e10e0b4593068649e4 (patch)
treeaaf6016150a2495a3499f64d1a578d78007bc40a /tests/basic-test.sh
parent673cacd633f9d6b653cdea530657d3e780a41bbd (diff)
downloadostree-9367a1befe045663a69265e10e0b4593068649e4.tar.gz
checkout: Support --union-identical and --force-copy{,--zerosized}
Actually testing the patch to add `--force-copy-zerosized` to rpm-ostree tripped over the fact that it uses `--union-identical`, and we just hit an assertion failure with that combination. Fix this by copying over the logic we have for the hardlink case. Closes: #1753 Approved by: jlebon
Diffstat (limited to 'tests/basic-test.sh')
-rw-r--r--tests/basic-test.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/basic-test.sh b/tests/basic-test.sh
index a817b9d1..3c4823d7 100644
--- a/tests/basic-test.sh
+++ b/tests/basic-test.sh
@@ -21,7 +21,7 @@
set -euo pipefail
-echo "1..$((84 + ${extra_basic_tests:-0}))"
+echo "1..$((85 + ${extra_basic_tests:-0}))"
CHECKOUT_U_ARG=""
CHECKOUT_H_ARGS="-H"
@@ -709,6 +709,20 @@ assert_files_hardlinked tree-with-empty-files/an{,other}emptyfile
rm tree-with-empty-files -rf
echo "ok checkout --force-copy-zerosized"
+# These should merge, they're identical
+$CMD_PREFIX ostree --repo=repo checkout ${CHECKOUT_H_ARGS} --union-identical -z tree-with-empty-files tree-with-empty-files
+$CMD_PREFIX ostree --repo=repo checkout ${CHECKOUT_H_ARGS} --union-identical -z tree-with-empty-files tree-with-empty-files
+echo notempty > tree-with-empty-files/anemptyfile.new && mv tree-with-empty-files/anemptyfile{.new,}
+$CMD_PREFIX ostree --repo=repo commit --consume -b tree-with-conflicting-empty-files --tree=dir=tree-with-empty-files
+# Reset back to base
+rm tree-with-empty-files -rf
+$CMD_PREFIX ostree --repo=repo checkout ${CHECKOUT_H_ARGS} --union-identical -z tree-with-empty-files tree-with-empty-files
+if $CMD_PREFIX ostree --repo=repo checkout ${CHECKOUT_H_ARGS} --union-identical -z tree-with-conflicting-empty-files tree-with-empty-files 2>err.txt; then
+ fatal "--union-identical --force-copy-zerosized unexpectedly succeeded with non-identical files"
+fi
+assert_file_has_content err.txt 'error:.*File exists'
+echo "ok checkout --union-identical --force-copy-zerosized"
+
cd ${test_tmpdir}
rm files -rf && mkdir files
mkdir files/worldwritable-dir