Skip to content

Commit ddea258

Browse files
committed
Replace git-url-parse with gix::url::parse
Keep the dependency try the same by leveraging already imported gix crate to try parsing a git url from a string
1 parent 283c6e8 commit ddea258

3 files changed

Lines changed: 7 additions & 157 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 150 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ curl-sys = "0.4.65"
3737
filetime = "0.2.21"
3838
flate2 = { version = "1.0.26", default-features = false, features = ["zlib"] }
3939
fwdansi = "1.1.0"
40-
git-url-parse = "0.4.0"
4140
git2 = "0.17.2"
4241
git2-curl = "0.18.0"
4342
gix = { version = "0.45.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree"] }
@@ -135,7 +134,6 @@ curl = { workspace = true, features = ["http2"] }
135134
curl-sys.workspace = true
136135
filetime.workspace = true
137136
flate2.workspace = true
138-
git-url-parse.workspace = true
139137
git2.workspace = true
140138
git2-curl.workspace = true
141139
gix.workspace = true

src/cargo/ops/common_for_install_and_uninstall.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ use std::rc::Rc;
77
use std::task::Poll;
88

99
use anyhow::{bail, format_err, Context as _};
10-
use git_url_parse::{GitUrl, Scheme};
10+
use gix::bstr::BStr;
11+
use gix::url::{parse, Scheme};
1112
use ops::FilterRule;
1213
use serde::{Deserialize, Serialize};
1314

@@ -538,14 +539,15 @@ enum InstallSuggestion {
538539
/// to rerun cargo install with
539540
fn was_git_url_miscategorised_as_a_registry_dep(dep: &Dependency) -> InstallSuggestion {
540541
if dep.source_id().is_registry() {
541-
if let Ok(git_url) = GitUrl::parse(&dep.package_name()) {
542+
if let Ok(git_url) = parse(BStr::new(dep.package_name().as_bytes())) {
542543
let final_git_url: Option<InternedString> = match git_url.scheme {
543544
// cargo doesn't support cargo install git@ urls, so
544-
Scheme::Ssh | Scheme::Git | Scheme::GitSsh => {
545-
if let (Some(host), Some(owner)) = (git_url.host, git_url.owner) {
545+
Scheme::Ssh | Scheme::Git => {
546+
if let (Some(host), Some(owner)) = (git_url.host(), git_url.user()) {
546547
let https_git_url = format!(
547548
"https://{host}/{owner}/{repo_name}",
548-
repo_name = git_url.name
549+
// repo_name = git_url.name()
550+
repo_name = "TODO"
549551
);
550552
Some(InternedString::from(https_git_url))
551553
} else {

0 commit comments

Comments
 (0)