summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-prune.c
diff options
context:
space:
mode:
authorAnne LoVerso <aelv13@gmail.com>2014-08-05 08:41:50 -0400
committerColin Walters <walters@verbum.org>2014-08-20 15:09:32 -0400
commit3742c329459615eca34fdd374673c76ac648ffba (patch)
tree99862dceb5c40cc9b42573c3403eb2ca88788d48 /src/libostree/ostree-repo-prune.c
parent6a55d2c32ffcb49de5f4d781315b67dcc885d6f7 (diff)
downloadostree-3742c329459615eca34fdd374673c76ac648ffba.tar.gz
repo-pull: Allow pulling only one directory
Changes the pull API to allow pulling only a single directory instead of the whole deployment. This option is utilized by the check-diff option in rpm-ostree. Add a new state directory to hold <checksum>.commitpartial files, so we know that we've only downloaded partial state.
Diffstat (limited to 'src/libostree/ostree-repo-prune.c')
-rw-r--r--src/libostree/ostree-repo-prune.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libostree/ostree-repo-prune.c b/src/libostree/ostree-repo-prune.c
index ac5364ac..05ba43a1 100644
--- a/src/libostree/ostree-repo-prune.c
+++ b/src/libostree/ostree-repo-prune.c
@@ -36,6 +36,23 @@ typedef struct {
} OtPruneData;
static gboolean
+prune_commitpartial_file (OstreeRepo *repo,
+ const char *checksum,
+ GCancellable *cancellable,
+ GError **error)
+{
+ gboolean ret = FALSE;
+ gs_unref_object GFile *objpath = ot_gfile_resolve_path_printf (repo->repodir, "state/%s.commitpartial", checksum);
+
+ if (!ot_gfile_ensure_unlinked (objpath, cancellable, error))
+ goto out;
+
+ ret = TRUE;
+ out:
+ return ret;
+}
+
+static gboolean
maybe_prune_loose_object (OtPruneData *data,
OstreeRepoPruneFlags flags,
const char *checksum,
@@ -54,6 +71,12 @@ maybe_prune_loose_object (OtPruneData *data,
{
guint64 storage_size = 0;
+ if (objtype == OSTREE_OBJECT_TYPE_COMMIT)
+ {
+ if (!prune_commitpartial_file (data->repo, checksum, cancellable, error))
+ goto out;
+ }
+
if (!ostree_repo_query_object_storage_size (data->repo, objtype, checksum,
&storage_size, cancellable, error))
goto out;