mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-09 12:58:38 +03:00
core: In user mode checkouts of archives, use hard links
Now that we've done all the gyrations to separate content from metadata in archives, we can just hard link when doing user checkouts.
This commit is contained in:
parent
e014b2d9c2
commit
134283afbf
@ -2262,7 +2262,18 @@ checkout_tree (OstreeRepo *self,
|
||||
{
|
||||
const char *checksum = _ostree_repo_file_get_checksum ((OstreeRepoFile*)src_child);
|
||||
|
||||
if (priv->mode == OSTREE_REPO_MODE_ARCHIVE)
|
||||
if (priv->mode == OSTREE_REPO_MODE_ARCHIVE && mode == OSTREE_REPO_CHECKOUT_MODE_USER)
|
||||
{
|
||||
g_clear_object (&object_path);
|
||||
object_path = ostree_repo_get_object_path (self, checksum, OSTREE_OBJECT_TYPE_ARCHIVED_FILE_CONTENT);
|
||||
|
||||
if (link (ot_gfile_get_path_cached (object_path), ot_gfile_get_path_cached (dest_path)) < 0)
|
||||
{
|
||||
ot_util_set_error_from_errno (error, errno);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (priv->mode == OSTREE_REPO_MODE_ARCHIVE)
|
||||
{
|
||||
ot_clear_gvariant (&archive_metadata);
|
||||
if (!ostree_repo_load_variant (self, OSTREE_OBJECT_TYPE_ARCHIVED_FILE_META, checksum, &archive_metadata, error))
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
echo "1..17"
|
||||
echo "1..18"
|
||||
|
||||
. libtest.sh
|
||||
|
||||
@ -148,3 +148,6 @@ ostree --repo=repo2 checkout test2 test2-checkout-from-local-clone
|
||||
cd test2-checkout-from-local-clone
|
||||
assert_file_has_content yet/another/tree/green 'leaf'
|
||||
echo "ok local clone checkout"
|
||||
|
||||
$OSTREE checkout -U test2 checkout-user-test2
|
||||
echo "ok user checkout"
|
||||
|
@ -21,7 +21,7 @@ set -e
|
||||
|
||||
. libtest.sh
|
||||
|
||||
echo '1..5'
|
||||
echo '1..6'
|
||||
|
||||
setup_test_repository "archive"
|
||||
echo "ok setup"
|
||||
@ -47,3 +47,6 @@ ostree --repo=repo2 checkout test2 test2-checkout-from-local-clone
|
||||
cd test2-checkout-from-local-clone
|
||||
assert_file_has_content baz/cow moo
|
||||
echo "ok local clone checkout"
|
||||
|
||||
$OSTREE checkout -U test2 checkout-user-test2
|
||||
echo "ok user checkout"
|
||||
|
Loading…
x
Reference in New Issue
Block a user