commit: Add _CONSUME modifier flag
For many cases of commit, we can actually optimize things by simply "adopting" the object rather than writing a new copy. For example, in rpm-ostree package layering. We can only make that optimization though if we take ownership of the file. This commit hence adds an API where a caller tells us to do so. For now, that just means we `unlink()` the files/dirs as we go, but we can now later add the "adopt" optimization. Closes: #1255 Approved by: jlebon
This commit is contained in:
1 parent
fc33ae018d
commit
bba7eb8069
6 files changed
+65
-1
No files matched your search
+11
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..$((73 + ${extra_basic_tests:-0}))"
|
||||
echo "1..$((74 + ${extra_basic_tests:-0}))"
|
||||
|
||||
CHECKOUT_U_ARG=""
|
||||
CHECKOUT_H_ARGS="-H"
|
||||
@@ -177,6 +177,16 @@ assert_file_has_content yet/another/tree/green 'leaf'
|
||||
assert_file_has_content four '4'
|
||||
echo "ok cwd contents"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm checkout-test2-l -rf
|
||||
$OSTREE checkout ${CHECKOUT_H_ARGS} test2 $test_tmpdir/checkout-test2-l
|
||||
date > $test_tmpdir/checkout-test2-l/newdatefile.txt
|
||||
$OSTREE commit --link-checkout-speedup --consume -b test2 --tree=dir=$test_tmpdir/checkout-test2-l
|
||||
assert_not_has_dir $test_tmpdir/checkout-test2-l
|
||||
# Some of the later tests are sensitive to state
|
||||
$OSTREE reset test2 test2^
|
||||
echo "ok consume (nom nom nom)"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
$OSTREE commit ${COMMIT_ARGS} -b test2-no-parent -s '' $test_tmpdir/checkout-test2-4
|
||||
assert_streq $($OSTREE log test2-no-parent |grep '^commit' | wc -l) "1"
|
||||
|
||||
Reference in new issue
Block a user