repo: Add a "force copy" flag to checkout

This is intended to be used for copying `/usr/etc` → `/etc` for
deployments.

A TODO here is to use `glnx_file_copy_at()` if the repo mode allows
it - then we'd use reflinks if available.

Closes: #804
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-04-24 15:26:11 +00:00
1 parent 3f1bcab27f
commit 6060abbb4b
4 files changed
+28 -6

No files matched your search

+3 -1
View File
@@ -403,7 +403,7 @@ checkout_one_file_at (OstreeRepo *repo,
need_copy = FALSE;
}
else
else if (!options->force_copy)
{
HardlinkResult hardlink_res = HARDLINK_RESULT_NOT_SUPPORTED;
/* Try to do a hardlink first, if it's a regular file. This also
@@ -895,6 +895,8 @@ ostree_repo_checkout_at (OstreeRepo *self,
if (ostree_repo_get_mode (self) == OSTREE_REPO_MODE_BARE_USER_ONLY)
options->mode = OSTREE_REPO_CHECKOUT_MODE_USER;
g_return_val_if_fail (!(options->force_copy && options->no_copy_fallback), FALSE);
g_autoptr(GFile) commit_root = (GFile*) _ostree_repo_file_new_for_commit (self, commit, error);
if (!commit_root)
return FALSE;
+2 -1
View File
@@ -767,7 +767,8 @@ typedef struct {
gboolean enable_fsync; /* Deprecated */
gboolean process_whiteouts;
gboolean no_copy_fallback;
gboolean unused_bools[7];
gboolean force_copy; /* Since: 2017.6 */
gboolean unused_bools[6];
const char *subpath;