pull: new option --commit-metadata-only

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano authored and Colin Walters committed 2015-07-24 12:43:35 -04:00
1 parent 56f0ae6a4a
commit 11ba9056ea
7 files changed
+72 -2

No files matched your search

+8 -1
View File
@@ -88,6 +88,7 @@ typedef struct {
guint64 start_time;
gboolean is_mirror;
gboolean is_commit_only;
char *dir;
gboolean commitpartial_exists;
@@ -1119,6 +1120,11 @@ scan_one_metadata_object_c (OtPullData *pull_data,
do_fetch_detached = (objtype == OSTREE_OBJECT_TYPE_COMMIT);
enqueue_one_object_request (pull_data, tmp_checksum, objtype, do_fetch_detached, FALSE);
}
else if (objtype == OSTREE_OBJECT_TYPE_COMMIT && pull_data->is_commit_only)
{
ret = TRUE;
goto out;
}
else if (is_stored)
{
gboolean do_scan = pull_data->transaction_resuming || is_requested || pull_data->commitpartial_exists;
@@ -1654,6 +1660,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
g_return_val_if_fail (dir_to_pull[0] == '/', FALSE);
pull_data->is_mirror = (flags & OSTREE_REPO_PULL_FLAGS_MIRROR) > 0;
pull_data->is_commit_only = (flags & OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY) > 0;
pull_data->async_error = error;
pull_data->main_context = g_main_context_ref_thread_default ();
@@ -2160,7 +2167,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
}
/* iterate over commits fetched and delete any commitpartial files */
if (!dir_to_pull)
if (!dir_to_pull && !pull_data->is_commit_only)
{
g_hash_table_iter_init (&hash_iter, requested_refs_to_fetch);
while (g_hash_table_iter_next (&hash_iter, &key, &value))
+3
View File
@@ -3674,6 +3674,9 @@ ostree_repo_read_commit (OstreeRepo *self,
* the @refs_to_fetch is %NULL, and the remote repository contains a
* summary file, then all refs will be fetched.
*
* If @flags contains %OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY, then only the
* metadata for the commits in @refs_to_fetch is pulled.
*
* Warning: This API will iterate the thread default main context,
* which is a bug, but kept for compatibility reasons. If you want to
* avoid this, use g_main_context_push_thread_default() to push a new
+3 -1
View File
@@ -693,10 +693,12 @@ gboolean ostree_repo_prune (OstreeRepo *self,
* OstreeRepoPullFlags:
* @OSTREE_REPO_PULL_FLAGS_NONE: No special options for pull
* @OSTREE_REPO_PULL_FLAGS_MIRROR: Write out refs suitable for mirrors
* @OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY: Fetch only the commit metadata
*/
typedef enum {
OSTREE_REPO_PULL_FLAGS_NONE,
OSTREE_REPO_PULL_FLAGS_MIRROR
OSTREE_REPO_PULL_FLAGS_MIRROR = (1 << 0),
OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY = (1 << 1)
} OstreeRepoPullFlags;
gboolean ostree_repo_pull (OstreeRepo *self,