core: Drop --link-cache option, we do it by default now for archives

This commit is contained in:
Colin Walters 2012-05-04 14:22:09 -04:00
parent 27358a8de6
commit 0fc291b954
5 changed files with 10 additions and 55 deletions

View File

@ -3951,7 +3951,6 @@ static gboolean
checkout_one_file (OstreeRepo *self,
OstreeRepoCheckoutMode mode,
OstreeRepoCheckoutOverwriteMode overwrite_mode,
GFile *link_cache,
OstreeRepoFile *src,
GFileInfo *file_info,
GFile *destination,
@ -3977,10 +3976,9 @@ checkout_one_file (OstreeRepo *self,
{
possible_loose_path = ostree_repo_get_object_path (self, checksum, OSTREE_OBJECT_TYPE_FILE);
}
else if (link_cache)
else if (priv->mode == OSTREE_REPO_MODE_ARCHIVE && mode == OSTREE_REPO_CHECKOUT_MODE_USER)
{
ot_lfree char *relpath = ostree_get_relative_object_path (checksum, OSTREE_OBJECT_TYPE_FILE);
possible_loose_path = g_file_resolve_relative_path (link_cache, relpath);
possible_loose_path = ostree_repo_get_archive_content_path (self, checksum);
}
if (possible_loose_path && lstat (ot_gfile_get_path_cached (possible_loose_path), &stbuf) >= 0)
@ -3998,23 +3996,6 @@ checkout_one_file (OstreeRepo *self,
if (!checkout_file_from_input (destination, mode, overwrite_mode, file_info, xattrs,
input, cancellable, error))
goto out;
if (link_cache)
{
ot_lobj GFile *parent = NULL;
g_assert (possible_loose_path);
parent = g_file_get_parent (possible_loose_path);
if (!ot_gfile_ensure_directory (parent, TRUE, error))
goto out;
if (link (ot_gfile_get_path_cached (destination),
ot_gfile_get_path_cached (possible_loose_path)) < 0)
{
ot_util_set_error_from_errno (error, errno);
goto out;
}
}
}
ret = TRUE;
@ -4026,7 +4007,6 @@ gboolean
ostree_repo_checkout_tree (OstreeRepo *self,
OstreeRepoCheckoutMode mode,
OstreeRepoCheckoutOverwriteMode overwrite_mode,
GFile *link_cache,
GFile *destination,
OstreeRepoFile *source,
GFileInfo *source_info,
@ -4071,14 +4051,14 @@ ostree_repo_checkout_tree (OstreeRepo *self,
if (type == G_FILE_TYPE_DIRECTORY)
{
if (!ostree_repo_checkout_tree (self, mode, overwrite_mode, link_cache,
if (!ostree_repo_checkout_tree (self, mode, overwrite_mode,
dest_path, (OstreeRepoFile*)src_child, file_info,
cancellable, error))
goto out;
}
else
{
if (!checkout_one_file (self, mode, overwrite_mode, link_cache,
if (!checkout_one_file (self, mode, overwrite_mode,
(OstreeRepoFile*)src_child, file_info,
dest_path, cancellable, error))
goto out;

View File

@ -322,7 +322,6 @@ gboolean
ostree_repo_checkout_tree (OstreeRepo *self,
OstreeRepoCheckoutMode mode,
OstreeRepoCheckoutOverwriteMode overwrite_mode,
GFile *link_cache,
GFile *destination,
OstreeRepoFile *source,
GFileInfo *source_info,

View File

@ -29,7 +29,6 @@
#include <glib/gi18n.h>
static char *opt_link_cache;
static gboolean opt_user_mode;
static gboolean opt_atomic_retarget;
static gboolean opt_no_triggers;
@ -38,7 +37,6 @@ static gboolean opt_union;
static gboolean opt_from_stdin;
static GOptionEntry options[] = {
{ "link-cache", 0, 0, G_OPTION_ARG_STRING, &opt_link_cache, "Use directory as lookaside cache for hard links", NULL },
{ "user-mode", 'U', 0, G_OPTION_ARG_NONE, &opt_user_mode, "Do not change file ownership or initialze extended attributes", NULL },
{ "subpath", 0, 0, G_OPTION_ARG_STRING, &opt_subpath, "Checkout sub-directory PATH", "PATH" },
{ "union", 0, 0, G_OPTION_ARG_NONE, &opt_union, "Keep existing directories, overwrite existing files", NULL },
@ -122,7 +120,6 @@ process_one_checkout (OstreeRepo *repo,
const char *resolved_commit,
const char *subpath,
GFile *target,
GFile *link_cache,
GCancellable *cancellable,
GError **error)
{
@ -148,7 +145,7 @@ process_one_checkout (OstreeRepo *repo,
if (!ostree_repo_checkout_tree (repo, opt_user_mode ? OSTREE_REPO_CHECKOUT_MODE_USER : 0,
opt_union ? OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES : 0,
link_cache, target, subtree, file_info, cancellable, error))
target, subtree, file_info, cancellable, error))
goto out;
ret = TRUE;
@ -158,7 +155,6 @@ process_one_checkout (OstreeRepo *repo,
static gboolean
process_many_checkouts (OstreeRepo *repo,
GFile *link_cache,
GFile *target,
GCancellable *cancellable,
GError **error)
@ -198,7 +194,7 @@ process_many_checkouts (OstreeRepo *repo,
if (!ostree_repo_resolve_rev (repo, revision, FALSE, &resolved_commit, error))
goto out;
if (!process_one_checkout (repo, resolved_commit, subpath, target, link_cache,
if (!process_one_checkout (repo, resolved_commit, subpath, target,
cancellable, error))
goto out;
@ -229,7 +225,6 @@ ostree_builtin_checkout (int argc, char **argv, GFile *repo_path, GError **error
ot_lfree char *resolved_commit = NULL;
ot_lfree char *suffixed_destination = NULL;
ot_lfree char *tmp_destination = NULL;
ot_lobj GFile *link_cache = NULL;
ot_lobj GFileInfo *symlink_file_info = NULL;
ot_lobj GFile *checkout_target = NULL;
ot_lobj GFile *checkout_target_tmp = NULL;
@ -255,9 +250,6 @@ ostree_builtin_checkout (int argc, char **argv, GFile *repo_path, GError **error
goto out;
}
if (opt_link_cache)
link_cache = ot_gfile_new_for_path (opt_link_cache);
if (opt_from_stdin)
{
if (opt_atomic_retarget)
@ -270,7 +262,7 @@ ostree_builtin_checkout (int argc, char **argv, GFile *repo_path, GError **error
destination = argv[1];
checkout_target = ot_gfile_new_for_path (destination);
if (!process_many_checkouts (repo, link_cache, checkout_target, cancellable, error))
if (!process_many_checkouts (repo, checkout_target, cancellable, error))
goto out;
if (!opt_no_triggers)
@ -329,7 +321,7 @@ ostree_builtin_checkout (int argc, char **argv, GFile *repo_path, GError **error
{
if (!process_one_checkout (repo, resolved_commit, opt_subpath,
checkout_target_tmp ? checkout_target_tmp : checkout_target,
link_cache, cancellable, error))
cancellable, error))
goto out;
if (!opt_no_triggers)

View File

@ -19,7 +19,7 @@
set -e
echo "1..31"
echo "1..30"
. libtest.sh
@ -212,14 +212,6 @@ cd test2
assert_file_has_content ./yet/another/tree/green "leaf"
echo "ok checkout short form"
cd ${test_tmpdir}
rm -rf test2
mkdir linkcache
$OSTREE checkout --link-cache=linkcache test2 test2-checkout-from-link-cache
cd test2-checkout-from-link-cache
assert_file_has_content ./yet/another/tree/green "leaf"
echo "ok checkout link cache"
cd ${test_tmpdir}
rm -rf shadow-repo
mkdir shadow-repo

View File

@ -21,7 +21,7 @@ set -e
. libtest.sh
echo '1..23'
echo '1..22'
setup_test_repository "archive"
echo "ok setup"
@ -97,14 +97,6 @@ cd ${test_tmpdir}
$OSTREE checkout test2 checkout-test2-from-unpacked
echo "ok checkout union 2"
cd ${test_tmpdir}
rm -rf test2
mkdir linkcache
$OSTREE checkout --user-mode --link-cache=linkcache test2 test2
cd test2
assert_file_has_content baz/cow moo
echo "ok checkout link cache"
$OSTREE pack --metadata-only
echo "ok pack metadata"