From 58508e2a53d58597d9ffd1d9d7a3aab769d5adf2 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 17 Mar 2022 09:31:59 -0700 Subject: [PATCH] Separate VCS command paths with "--" When building a VCS command, there may be ambiguity if a relative path looks like an option, like "-path" or "--path". All of the VCS commands that we use support a bare "--" separator for non-option arguments, which is good practice to apply here. This does not affect the cargo CLI, as it already makes sure to use absolute paths for these calls via `value_of_path()`. --- src/cargo/util/vcs.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cargo/util/vcs.rs b/src/cargo/util/vcs.rs index 1477510e22a..095164e23df 100644 --- a/src/cargo/util/vcs.rs +++ b/src/cargo/util/vcs.rs @@ -45,6 +45,7 @@ impl HgRepo { ProcessBuilder::new("hg") .cwd(cwd) .arg("init") + .arg("--") .arg(path) .exec()?; Ok(HgRepo) @@ -65,6 +66,7 @@ impl PijulRepo { ProcessBuilder::new("pijul") .cwd(cwd) .arg("init") + .arg("--") .arg(path) .exec()?; Ok(PijulRepo) @@ -85,6 +87,7 @@ impl FossilRepo { ProcessBuilder::new("fossil") .cwd(cwd) .arg("init") + .arg("--") .arg(&db_path) .exec()?; @@ -92,6 +95,7 @@ impl FossilRepo { ProcessBuilder::new("fossil") .cwd(&path) .arg("open") + .arg("--") .arg(db_fname) .exec()?;