diff --git a/Cargo.lock b/Cargo.lock index f27146df67e83..7d27fb0bb279f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4414,6 +4414,7 @@ dependencies = [ "indicatif 0.18.0", "itertools 0.14.0", "mimalloc", + "path-slash", "rayon", "regex", "rustls", diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 668bd7acefc95..d9acf1de83d09 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -42,6 +42,7 @@ futures.workspace = true indicatif.workspace = true itertools.workspace = true mimalloc = { workspace = true, optional = true } +path-slash.workspace = true rayon.workspace = true regex = { workspace = true, default-features = false } serde_json.workspace = true diff --git a/crates/cli/src/utils/mod.rs b/crates/cli/src/utils/mod.rs index 61a0290f14f1c..942fe6ae805b9 100644 --- a/crates/cli/src/utils/mod.rs +++ b/crates/cli/src/utils/mod.rs @@ -8,6 +8,7 @@ use foundry_common::{ }; use foundry_config::{Chain, Config}; use itertools::Itertools; +use path_slash::PathExt; use regex::Regex; use serde::de::DeserializeOwned; use std::{ @@ -718,13 +719,9 @@ ignore them in the `.gitignore` file." } /// Get the URL of a submodule from git config - pub fn submodule_url(self, path: impl AsRef) -> Result> { + pub fn submodule_url(self, path: &Path) -> Result> { self.cmd() - .args([ - "config", - "--get", - &format!("submodule.{}.url", path.as_ref().to_string_lossy()), - ]) + .args(["config", "--get", &format!("submodule.{}.url", path.to_slash_lossy())]) .get_stdout_lossy() .map(|url| Some(url.trim().to_string())) } diff --git a/crates/forge/src/cmd/remove.rs b/crates/forge/src/cmd/remove.rs index f4cb60de039bd..6a6d217450076 100644 --- a/crates/forge/src/cmd/remove.rs +++ b/crates/forge/src/cmd/remove.rs @@ -33,7 +33,6 @@ impl RemoveArgs { let config = self.load_config()?; let (root, paths, _) = super::update::dependencies_paths(&self.dependencies, &config)?; let git_modules = root.join(".git/modules"); - let git = Git::new(&root); let mut lockfile = Lockfile::new(&config.root).with_git(&git); let _synced = lockfile.sync(config.install_lib_dir())?; diff --git a/crates/forge/tests/cli/install.rs b/crates/forge/tests/cli/install.rs index d92834203aa82..197d3f14f565d 100644 --- a/crates/forge/tests/cli/install.rs +++ b/crates/forge/tests/cli/install.rs @@ -108,10 +108,9 @@ Installing forge-std in [..] (url: Some("https://github.com/foundry-rs/forge-std }; let remove = |cmd: &mut TestCommand, target: &str| { - // TODO: flaky behavior with URL, sometimes it is None, sometimes it is Some("https://github.com/lib/forge-std") cmd.forge_fuse().args(["remove", "--force", target]).assert_success().stdout_eq(str![[ r#" -Removing 'forge-std' in [..], (url: [..], tag: None) +Removing 'forge-std' in [..], (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) "# ]]);