Only support `rad://` in the custom proto
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
parent
1da38708fc
commit
f85a0426d7
|
|
@ -894,7 +894,7 @@ mod tests {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Register the `rad://` transport.
|
// Register the `rad://` transport.
|
||||||
transport::register("rad").unwrap();
|
transport::register().unwrap();
|
||||||
// Fetch with the `rad://` transport.
|
// Fetch with the `rad://` transport.
|
||||||
target
|
target
|
||||||
.remote_anonymous(&format!("rad://{}", proj))
|
.remote_anonymous(&format!("rad://{}", proj))
|
||||||
|
|
|
||||||
|
|
@ -160,13 +160,14 @@ impl io::Read for Stream {
|
||||||
///
|
///
|
||||||
/// Returns an error if called more than once.
|
/// 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);
|
static REGISTERED: atomic::AtomicBool = atomic::AtomicBool::new(false);
|
||||||
|
|
||||||
// Registration is not thread-safe, so make sure we prevent re-entrancy.
|
// Registration is not thread-safe, so make sure we prevent re-entrancy.
|
||||||
if !REGISTERED.swap(true, atomic::Ordering::SeqCst) {
|
if !REGISTERED.swap(true, atomic::Ordering::SeqCst) {
|
||||||
unsafe {
|
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())
|
git2::transport::Transport::smart(remote, false, self::smart())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue