mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
Refactor: Extract new crate simple-git
(#1304)
`binstalk-downloader` contains stuff about http(s) before the git code is moved into it and now it becomes http and git. While git indeed uses http stuff, which is why I decided to put it into binstalk-downloader, it is more than just downloading since it is stateful (can be cached locally and updated) where as http is stateless. Also `binstalk-downloader`'s codegen time now increases dramatically and it also creates extra dependencies for binstalk-fetchers, delaying its execution. The git code also don't use anything from `binstalk-downloader` at all, it makes sense to be an independent crate. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
20a57a9a9b
commit
dc77a1ab93
17 changed files with 258 additions and 24 deletions
|
@ -25,6 +25,7 @@ semver = { version = "1.0.17", features = ["serde"] }
|
|||
serde = { version = "1.0.163", features = ["derive"] }
|
||||
serde_json = "1.0.99"
|
||||
sha2 = "0.10.7"
|
||||
simple-git = { version = "0.0.0", path = "../simple-git", optional = true }
|
||||
tempfile = "3.5.0"
|
||||
thiserror = "1.0.40"
|
||||
tokio = { version = "1.30.0", features = ["rt", "sync"], default-features = false }
|
||||
|
@ -36,7 +37,7 @@ tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
|
|||
toml_edit = { version = "0.19.11", features = ["serde"] }
|
||||
|
||||
[features]
|
||||
git = ["binstalk-downloader/git"]
|
||||
git = ["simple-git"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
use std::{io, path::PathBuf, sync::Arc};
|
||||
|
||||
use binstalk_downloader::{
|
||||
git::{GitCancellationToken, GitUrl, Repository},
|
||||
remote::Client,
|
||||
};
|
||||
use binstalk_downloader::remote::Client;
|
||||
use binstalk_types::cargo_toml_binstall::Meta;
|
||||
use cargo_toml_workspace::cargo_toml::Manifest;
|
||||
use compact_str::{CompactString, ToCompactString};
|
||||
use once_cell::sync::OnceCell;
|
||||
use semver::VersionReq;
|
||||
use serde_json::{from_slice as json_from_slice, Deserializer as JsonDeserializer};
|
||||
use simple_git::{GitCancellationToken, GitUrl, Repository};
|
||||
use tempfile::TempDir;
|
||||
use tokio::task::spawn_blocking;
|
||||
use url::Url;
|
||||
|
|
|
@ -19,7 +19,7 @@ use tokio::task;
|
|||
use url::{ParseError as UrlParseError, Url};
|
||||
|
||||
#[cfg(feature = "git")]
|
||||
pub use binstalk_downloader::git::{GitError, GitUrl, GitUrlParseError};
|
||||
pub use simple_git::{GitError, GitUrl, GitUrlParseError};
|
||||
|
||||
mod vfs;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue