mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-15 07:40:36 +08:00
node: Start working on git-fetch
Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
use std::net;
|
||||
|
||||
use crate::identity::ProjId;
|
||||
use crate::storage::{Error, WriteStorage};
|
||||
|
||||
/// Default port of the `git` transport protocol.
|
||||
pub const PROTOCOL_PORT: u16 = 9418;
|
||||
|
||||
pub fn fetch<S: WriteStorage>(
|
||||
_proj: &ProjId,
|
||||
remote: &net::SocketAddr,
|
||||
mut storage: S,
|
||||
) -> Result<(), Error> {
|
||||
let _repo = storage.repository();
|
||||
|
||||
let url = format!("git://{}", remote);
|
||||
let refs: &[&str] = &[];
|
||||
let mut remote = git2::Remote::create_detached(&url)?;
|
||||
let mut opts = git2::FetchOptions::default();
|
||||
|
||||
remote.fetch(refs, Some(&mut opts), None)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user