repo: Add ostree_repo_remote_get_url()

Peeking at remote details by way of ostree_repo_copy_config() doesn't
work anymore.
This commit is contained in:
Matthew Barnes committed 2014-12-08 12:49:23 -05:00
1 parent 17b9e399b8
commit f79896693e
3 files changed
+47 -9

No files matched your search

+41
View File
@@ -701,6 +701,47 @@ ostree_repo_remote_delete (OstreeRepo *self,
return ret;
}
/**
* ostree_repo_remote_get_url:
* @self: Repo
* @name: Name of remote
* @out_url: (out) (allow-none): Remote's URL
* @error: Error
*
* Return the URL of the remote named @name through @out_url. It is an
* error if the provided remote does not exist.
*
* Returns: %TRUE on success, %FALSE on failure
*/
gboolean
ostree_repo_remote_get_url (OstreeRepo *self,
const char *name,
char **out_url,
GError **error)
{
local_cleanup_remote OstreeRemote *remote = NULL;
gs_free char *url = NULL;
gboolean ret = FALSE;
g_return_val_if_fail (name != NULL, FALSE);
remote = ost_repo_get_remote (self, name, error);
if (remote == NULL)
goto out;
url = g_key_file_get_string (remote->options, remote->group, "url", error);
if (url != NULL)
{
gs_transfer_out_value (out_url, &url);
ret = TRUE;
}
out:
return ret;
}
static gboolean
ostree_repo_mode_to_string (OstreeRepoMode mode,
const char **out_mode,
+5
View File
@@ -79,6 +79,11 @@ gboolean ostree_repo_remote_delete (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
gboolean ostree_repo_remote_get_url (OstreeRepo *self,
const char *name,
char **out_url,
GError **error);
OstreeRepo * ostree_repo_get_parent (OstreeRepo *self);
gboolean ostree_repo_write_config (OstreeRepo *self,