Remove `git-url` dependency
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
parent
7b7e83fbc7
commit
6f3a598cc1
|
|
@ -197,16 +197,6 @@ dependencies = [
|
|||
"siphasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.11.0"
|
||||
|
|
@ -523,19 +513,6 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "git-url"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9fcc88c679f3dc55e1e4fe0324142abec612cafaafae1bf6a951c324c9d96f8"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"home",
|
||||
"quick-error",
|
||||
"serde",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.15.0"
|
||||
|
|
@ -592,15 +569,6 @@ dependencies = [
|
|||
"digest 0.10.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "home"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.8"
|
||||
|
|
@ -1076,12 +1044,6 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
|
||||
|
||||
[[package]]
|
||||
name = "quickcheck"
|
||||
version = "1.0.3"
|
||||
|
|
@ -1121,7 +1083,6 @@ dependencies = [
|
|||
"ed25519-compact",
|
||||
"fastrand",
|
||||
"git-ref-format",
|
||||
"git-url",
|
||||
"git2",
|
||||
"log",
|
||||
"multibase",
|
||||
|
|
|
|||
|
|
@ -46,11 +46,6 @@ pub enum Error {
|
|||
InvalidFilterSize(usize),
|
||||
#[error(transparent)]
|
||||
InvalidRefName(#[from] fmt::Error),
|
||||
#[error("invalid git url `{url}`: {error}")]
|
||||
InvalidGitUrl {
|
||||
url: String,
|
||||
error: git::url::parse::Error,
|
||||
},
|
||||
#[error("unknown address type `{0}`")]
|
||||
UnknownAddressType(u8),
|
||||
#[error("unknown message type `{0}`")]
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ crossbeam-channel = { version = "0.5.6" }
|
|||
ed25519-compact = { version = "1.0.12", features = ["pem"] }
|
||||
fastrand = { version = "1.8.0" }
|
||||
git-ref-format = { version = "0", features = ["serde", "macro"] }
|
||||
git-url = { version = "0.3.5", features = ["serde1"] }
|
||||
multibase = { version = "0.9.1" }
|
||||
log = { version = "0.4.17", features = ["std"] }
|
||||
once_cell = { version = "1.13" }
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ pub use git_ref_format as fmt;
|
|||
pub use git_ref_format::{
|
||||
lit, name, qualified, refname, Component, Namespaced, Qualified, RefStr, RefString,
|
||||
};
|
||||
pub use git_url as url;
|
||||
pub use radicle_git_ext as ext;
|
||||
pub use storage::git::transport::local::Url;
|
||||
pub use storage::BranchName;
|
||||
|
|
@ -351,6 +350,29 @@ where
|
|||
))
|
||||
}
|
||||
|
||||
/// Git URLs.
|
||||
pub mod url {
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// A Git URL using the `file://` scheme.
|
||||
pub struct File {
|
||||
pub path: PathBuf,
|
||||
}
|
||||
|
||||
impl File {
|
||||
/// Create a new file URL pointing to the given path.
|
||||
pub fn new(path: PathBuf) -> Self {
|
||||
Self { path }
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for File {
|
||||
fn to_string(&self) -> String {
|
||||
format!("file://{}", self.path.display())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Parsing and formatting of commit objects.
|
||||
/// This module exists to work with commits that have multiple signature headers.
|
||||
pub mod commit {
|
||||
|
|
|
|||
|
|
@ -552,12 +552,9 @@ impl WriteRepository for Repository {
|
|||
// TODO: Due to this, I think we'll have to run GC when there is a failure.
|
||||
.clone_local(git2::build::CloneLocal::Local)
|
||||
.clone(
|
||||
&git::url::Url {
|
||||
scheme: git::url::Scheme::File,
|
||||
path: self.backend.path().to_string_lossy().to_string().into(),
|
||||
..git::url::Url::default()
|
||||
}
|
||||
.to_string(),
|
||||
git::url::File::new(self.backend.path().to_path_buf())
|
||||
.to_string()
|
||||
.as_str(),
|
||||
&path,
|
||||
)?;
|
||||
|
||||
|
|
@ -602,14 +599,9 @@ impl WriteRepository for Repository {
|
|||
});
|
||||
|
||||
{
|
||||
let mut remote = self.backend.remote_anonymous(
|
||||
&git::url::Url {
|
||||
scheme: git::url::Scheme::File,
|
||||
path: staging.to_string_lossy().to_string().into(),
|
||||
..git::url::Url::default()
|
||||
}
|
||||
.to_string(),
|
||||
)?;
|
||||
let mut remote = self
|
||||
.backend
|
||||
.remote_anonymous(git::url::File::new(staging).to_string().as_str())?;
|
||||
let mut opts = git2::FetchOptions::default();
|
||||
opts.remote_callbacks(callbacks);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue