summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-remote.c
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2017-09-21 16:04:11 +0100
committerAtomic Bot <atomic-devel@projectatomic.io>2017-09-27 16:38:07 +0000
commit69e332a0c034b9d0e754372b3c9d653f492a97c7 (patch)
treec2927189c093b245a09f99d2bdf94788baf2b37e /src/libostree/ostree-remote.c
parent22c1fdfbd320379a09f4a670126bc28cdc383b87 (diff)
downloadostree-69e332a0c034b9d0e754372b3c9d653f492a97c7.tar.gz
lib/remote: Store name of remote providing keyring for dynamic remotes
When pulling from a dynamic (peer to peer) remote, the remote’s name is set to a unique, generated string which doesn’t exist in repo/config. If doing a non-mirror pull, however, we don’t want to use this name in the refspecs for newly created or updated refs — we want to use the name of the remote which provided the keyring for the pull (this will be a remote from repo/config whose collection ID matches that being used for the peer to peer pull). Store both names in OstreeRemote. The name to use for refspecs is stored as refspec_name, and is typically NULL unless it differs from name. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1202 Approved by: cgwalters
Diffstat (limited to 'src/libostree/ostree-remote.c')
-rw-r--r--src/libostree/ostree-remote.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libostree/ostree-remote.c b/src/libostree/ostree-remote.c
index cac7838c..605a7eb9 100644
--- a/src/libostree/ostree-remote.c
+++ b/src/libostree/ostree-remote.c
@@ -54,15 +54,24 @@
OstreeRemote *
ostree_remote_new (const gchar *name)
{
+ return ostree_remote_new_dynamic (name, NULL);
+}
+
+OstreeRemote *
+ostree_remote_new_dynamic (const gchar *name,
+ const gchar *refspec_name)
+{
OstreeRemote *remote;
g_return_val_if_fail (name != NULL && *name != '\0', NULL);
+ g_return_val_if_fail (refspec_name == NULL || *refspec_name != '\0', NULL);
remote = g_slice_new0 (OstreeRemote);
remote->ref_count = 1;
remote->name = g_strdup (name);
- remote->group = g_strdup_printf ("remote \"%s\"", name);
- remote->keyring = g_strdup_printf ("%s.trustedkeys.gpg", name);
+ remote->refspec_name = g_strdup (refspec_name);
+ remote->group = g_strdup_printf ("remote \"%s\"", (refspec_name != NULL) ? refspec_name : name);
+ remote->keyring = g_strdup_printf ("%s.trustedkeys.gpg", (refspec_name != NULL) ? refspec_name : name);
remote->options = g_key_file_new ();
return remote;