[ostree] pull: Allow pulling multiple specific refs
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] pull: Allow pulling multiple specific refs
- Date: Tue, 28 Feb 2012 18:20:53 +0000 (UTC)
commit 6829ab226092b8ad706c67bc9941e29713e87da1
Author: Colin Walters <walters verbum org>
Date: Tue Feb 28 13:17:03 2012 -0500
pull: Allow pulling multiple specific refs
src/ostree/ostree-pull.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c
index ad108eb..40f3d46 100644
--- a/src/ostree/ostree-pull.c
+++ b/src/ostree/ostree-pull.c
@@ -658,7 +658,6 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
gboolean ret = FALSE;
OstreeRepo *repo = NULL;
const char *remote;
- const char *branch;
SoupSession *soup = NULL;
char *path = NULL;
char *baseurl = NULL;
@@ -671,8 +670,9 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
GHashTableIter hash_iter;
gpointer key, value;
char *branch_rev = NULL;
+ int i;
- context = g_option_context_new ("REMOTE [BRANCH] - Download data from remote repository");
+ context = g_option_context_new ("REMOTE [BRANCH...] - Download data from remote repository");
g_option_context_add_main_entries (context, options, NULL);
if (!g_option_context_parse (context, &argc, &argv, error))
@@ -689,10 +689,6 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
}
remote = argv[1];
- if (argc == 2)
- branch = NULL;
- else
- branch = argv[2];
soup = soup_session_sync_new_with_options (SOUP_SESSION_USER_AGENT, "ostree ",
SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_COOKIE_JAR,
@@ -713,16 +709,20 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
goto out;
}
- if (branch != NULL)
+ if (argc > 2)
{
- char *contents;
-
- if (!fetch_ref_contents (repo, soup, base_uri, branch, &contents, cancellable, error))
- goto out;
-
- /* Transfer ownership of contents */
refs_to_fetch = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- g_hash_table_insert (refs_to_fetch, g_strdup (branch), contents);
+ for (i = 2; i < argc; i++)
+ {
+ const char *branch = argv[i];
+ char *contents;
+
+ if (!fetch_ref_contents (repo, soup, base_uri, branch, &contents, cancellable, error))
+ goto out;
+
+ /* Transfer ownership of contents */
+ g_hash_table_insert (refs_to_fetch, g_strdup (branch), contents);
+ }
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]