mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 14:28:42 +00:00
Fix v1 manifest format for git and local path (#1821)
* Bump simple-git to v0.2.10 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix v1 manifest format for git and local path Fixed #1815 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix v1 format for custom registry Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Remove unused functions Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix compilation Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Update git.sh Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fixed git.sh for windows Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * fixx git.sh for win Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Update git.sh Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * fix git.sh Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --------- Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
parent
5a316b765f
commit
eba07fb147
12 changed files with 112 additions and 38 deletions
|
@ -1,4 +1,4 @@
|
|||
use std::{io, path::PathBuf, sync::Arc};
|
||||
use std::{fmt::Display, io, path::PathBuf, sync::Arc};
|
||||
|
||||
use binstalk_downloader::remote::Client;
|
||||
use binstalk_types::cargo_toml_binstall::Meta;
|
||||
|
@ -73,6 +73,10 @@ impl GitRegistry {
|
|||
}))
|
||||
}
|
||||
|
||||
pub fn url(&self) -> impl Display + '_ {
|
||||
&self.0.url
|
||||
}
|
||||
|
||||
/// WARNING: This is a blocking operation.
|
||||
fn find_crate_matched_ver(
|
||||
repo: &Repository,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
|
||||
use std::{io, str::FromStr, sync::Arc};
|
||||
use std::{fmt, io, str::FromStr, sync::Arc};
|
||||
|
||||
use base16::DecodeError as Base16DecodeError;
|
||||
use binstalk_downloader::{
|
||||
|
@ -197,6 +197,16 @@ impl Registry {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Registry {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
#[cfg(feature = "git")]
|
||||
Registry::Git(registry) => fmt::Display::fmt(®istry.url(), f),
|
||||
Registry::Sparse(registry) => fmt::Display::fmt(®istry.url(), f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Registry {
|
||||
type Err = InvalidRegistryError;
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use std::fmt::Display;
|
||||
|
||||
use binstalk_downloader::remote::{Client, Error as RemoteError};
|
||||
use binstalk_types::cargo_toml_binstall::Meta;
|
||||
use cargo_toml_workspace::cargo_toml::Manifest;
|
||||
|
@ -28,6 +30,10 @@ impl SparseRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn url(&self) -> impl Display + '_ {
|
||||
&self.url
|
||||
}
|
||||
|
||||
async fn get_dl_template(&self, client: &Client) -> Result<&str, RegistryError> {
|
||||
self.dl_template
|
||||
.get_or_try_init(|| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue