[ostree] repo: Add _ostree_repo_get_remote_option_inherit()
- From: Giuseppe Scrivano <gscrivano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] repo: Add _ostree_repo_get_remote_option_inherit()
- Date: Fri, 26 Jun 2015 09:15:02 +0000 (UTC)
commit e592faec43a85a0b994c831cd6395a7634e2980a
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Jun 6 15:52:44 2015 -0400
repo: Add _ostree_repo_get_remote_option_inherit()
Split out from ostree-repo-pull.c. Still private but more reusable now.
src/libostree/ostree-repo-private.h | 7 +++++++
src/libostree/ostree-repo-pull.c | 31 +------------------------------
src/libostree/ostree-repo.c | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 43 insertions(+), 30 deletions(-)
---
diff --git a/src/libostree/ostree-repo-private.h b/src/libostree/ostree-repo-private.h
index 0218315..b124e22 100644
--- a/src/libostree/ostree-repo-private.h
+++ b/src/libostree/ostree-repo-private.h
@@ -196,6 +196,13 @@ _ostree_repo_get_remote_boolean_option (OstreeRepo *self,
gboolean *out_value,
GError **error);
+gboolean
+_ostree_repo_get_remote_option_inherit (OstreeRepo *self,
+ const char *remote_name,
+ const char *option_name,
+ char **out_value,
+ GError **error);
+
OstreeFetcher *
_ostree_repo_remote_new_fetcher (OstreeRepo *self,
const char *remote_name,
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index 6a4f7d0..2a4281f 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -1246,35 +1246,6 @@ enqueue_one_object_request (OtPullData *pull_data,
}
static gboolean
-repo_get_remote_option_inherit (OstreeRepo *self,
- const char *remote_name,
- const char *option_name,
- char **out_value,
- GError **error)
-{
- OstreeRepo *parent = ostree_repo_get_parent (self);
- g_autofree char *value = NULL;
- gboolean ret = FALSE;
-
- if (!_ostree_repo_get_remote_option (self, remote_name, option_name, NULL, &value, error))
- goto out;
-
- if (value == NULL && parent != NULL)
- {
- if (!repo_get_remote_option_inherit (parent, remote_name, option_name, &value, error))
- goto out;
- }
-
- /* Success here just means no error occurred during lookup,
- * not necessarily that we found a value for the option name. */
- ot_transfer_out_value (out_value, &value);
- ret = TRUE;
-
- out:
- return ret;
-}
-
-static gboolean
load_remote_repo_config (OtPullData *pull_data,
GKeyFile **out_keyfile,
GCancellable *cancellable,
@@ -1735,7 +1706,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
{
if (baseurl == NULL)
{
- if (!repo_get_remote_option_inherit (self, remote_name_or_baseurl, "url", &baseurl, error))
+ if (!_ostree_repo_get_remote_option_inherit (self, remote_name_or_baseurl, "url", &baseurl, error))
goto out;
}
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 5191e21..2353ffa 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -355,6 +355,41 @@ _ostree_repo_get_remote_boolean_option (OstreeRepo *self,
return ret;
}
+gboolean
+_ostree_repo_get_remote_option_inherit (OstreeRepo *self,
+ const char *remote_name,
+ const char *option_name,
+ char **out_value,
+ GError **error)
+{
+ OstreeRepo *parent = ostree_repo_get_parent (self);
+ g_autofree char *value = NULL;
+ gboolean ret = FALSE;
+
+ if (!_ostree_repo_get_remote_option (self,
+ remote_name, option_name,
+ NULL, &value, error))
+ goto out;
+
+ if (value == NULL && parent != NULL)
+ {
+ if (!_ostree_repo_get_remote_option_inherit (parent,
+ remote_name, option_name,
+ &value, error))
+ goto out;
+ }
+
+ /* Success here just means no error occurred during lookup,
+ * not necessarily that we found a value for the option name. */
+ if (out_value != NULL)
+ *out_value = g_steal_pointer (&value);
+
+ ret = TRUE;
+
+out:
+ return ret;
+}
+
OstreeFetcher *
_ostree_repo_remote_new_fetcher (OstreeRepo *self,
const char *remote_name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]