From f85a0426d7c41a312e005a9ce4024d7760613c8e Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Wed, 28 Sep 2022 13:45:03 +0200 Subject: [PATCH] Only support `rad://` in the custom proto Signed-off-by: Alexis Sellier --- radicle/src/storage/git.rs | 2 +- radicle/src/storage/git/transport.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/radicle/src/storage/git.rs b/radicle/src/storage/git.rs index fc405c84..d9195474 100644 --- a/radicle/src/storage/git.rs +++ b/radicle/src/storage/git.rs @@ -894,7 +894,7 @@ mod tests { }); // Register the `rad://` transport. - transport::register("rad").unwrap(); + transport::register().unwrap(); // Fetch with the `rad://` transport. target .remote_anonymous(&format!("rad://{}", proj)) diff --git a/radicle/src/storage/git/transport.rs b/radicle/src/storage/git/transport.rs index 7d887fbe..8a843abf 100644 --- a/radicle/src/storage/git/transport.rs +++ b/radicle/src/storage/git/transport.rs @@ -160,13 +160,14 @@ impl io::Read for Stream { /// /// Returns an error if called more than once. /// -pub fn register(prefix: &str) -> Result<(), git2::Error> { +pub fn register() -> Result<(), git2::Error> { static REGISTERED: atomic::AtomicBool = atomic::AtomicBool::new(false); // Registration is not thread-safe, so make sure we prevent re-entrancy. if !REGISTERED.swap(true, atomic::Ordering::SeqCst) { unsafe { - git2::transport::register(prefix, move |remote| { + let prefix = git::url::Scheme::Radicle.to_string(); + git2::transport::register(&prefix, move |remote| { git2::transport::Transport::smart(remote, false, self::smart()) }) }