/** * ostree_repo_checkout_tree_at: (skip) * @self: Repo * @options: (allow-none): Options * @destination_dfd: Directory FD for destination * @destination_path: Directory for destination * @commit: Checksum for commit * @cancellable: Cancellable * @error: Error * * Similar to ostree_repo_checkout_tree(), but uses directory-relative * paths for the destination, uses a new `OstreeRepoCheckoutAtOptions`, * and takes a commit checksum and optional subpath pair, rather than * requiring use of `GFile` APIs for the caller. * * Note in addition that unlike ostree_repo_checkout_tree(), the * default is not to use the repository-internal uncompressed objects * cache. * * This function is deprecated. Use ostree_repo_checkout_at() instead. */ gboolean ostree_repo_checkout_tree_at (OstreeRepo *self, OstreeRepoCheckoutOptions *options, int destination_dfd, const char *destination_path, const char *commit, GCancellable *cancellable, GError **error) { OstreeRepoCheckoutAtOptions new_opts = {0, }; new_opts.mode = options->mode; new_opts.overwrite_mode = options->overwrite_mode; new_opts.enable_uncompressed_cache = options->enable_uncompressed_cache; new_opts.enable_fsync = options->disable_fsync ? FALSE : self->disable_fsync; new_opts.process_whiteouts = options->process_whiteouts; new_opts.no_copy_fallback = options->no_copy_fallback; new_opts.subpath = options->subpath; new_opts.devino_to_csum_cache = options->devino_to_csum_cache; return ostree_repo_checkout_at (self, &new_opts, destination_dfd, destination_path, commit, cancellable, error); }
static gboolean process_one_checkout (OstreeRepo *repo, const char *resolved_commit, const char *subpath, const char *destination, GCancellable *cancellable, GError **error) { gboolean ret = FALSE; /* This strange code structure is to preserve testing * coverage of both `ostree_repo_checkout_tree` and * `ostree_repo_checkout_at` until such time as we have a more * convenient infrastructure for testing C APIs with data. */ if (opt_disable_cache || opt_whiteouts || opt_require_hardlinks) { OstreeRepoCheckoutAtOptions options = { 0, }; if (opt_user_mode) options.mode = OSTREE_REPO_CHECKOUT_MODE_USER; if (opt_union) options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES; if (opt_whiteouts) options.process_whiteouts = TRUE; if (subpath) options.subpath = subpath; options.no_copy_fallback = opt_require_hardlinks; if (!ostree_repo_checkout_at (repo, &options, AT_FDCWD, destination, resolved_commit, cancellable, error)) goto out; } else { GError *tmp_error = NULL; g_autoptr(GFile) root = NULL; g_autoptr(GFile) subtree = NULL; g_autoptr(GFileInfo) file_info = NULL; g_autoptr(GFile) destination_file = g_file_new_for_path (destination); if (!ostree_repo_read_commit (repo, resolved_commit, &root, NULL, cancellable, error)) goto out; if (subpath) subtree = g_file_resolve_relative_path (root, subpath); else subtree = g_object_ref (root); file_info = g_file_query_info (subtree, OSTREE_GIO_FAST_QUERYINFO, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, cancellable, &tmp_error); if (!file_info) { if (opt_allow_noent && g_error_matches (tmp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { g_clear_error (&tmp_error); ret = TRUE; } else { g_propagate_error (error, tmp_error); } goto out; } if (!ostree_repo_checkout_tree (repo, opt_user_mode ? OSTREE_REPO_CHECKOUT_MODE_USER : 0, opt_union ? OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES : 0, destination_file, OSTREE_REPO_FILE (subtree), file_info, cancellable, error)) goto out; } ret = TRUE; out: return ret; }