hyprstream_p2p/git/
mod.rs1pub mod objects;
4pub mod protocol;
5pub mod remote;
6pub mod remote_helper;
7pub mod repository;
8pub mod transport;
9
10pub use objects::*;
11pub use protocol::*;
12pub use remote::*;
13pub use repository::Repository;
14pub use transport::{register_gittorrent_transport, GittorrentTransportFactory};
15
16use crate::Result;
17use std::path::PathBuf;
18
19pub(crate) async fn with_repo_blocking<F, T>(path: PathBuf, f: F) -> Result<T>
24where
25 F: FnOnce(git2::Repository) -> Result<T> + Send + 'static,
26 T: Send + 'static,
27{
28 tokio::task::spawn_blocking(move || {
29 let repo = git2::Repository::open(&path)?;
30 f(repo)
31 })
32 .await
33 .map_err(|e| crate::Error::other(format!("Task join error: {e}")))?
34}