Skip to content

Commit

Permalink
Auto merge of #10483 - cuviper:vcs--, r=Eh2406
Browse files Browse the repository at this point in the history
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()`.
  • Loading branch information
bors committed Mar 17, 2022
2 parents 2ac382d + 58508e2 commit 1023fa5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cargo/util/vcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ impl HgRepo {
ProcessBuilder::new("hg")
.cwd(cwd)
.arg("init")
.arg("--")
.arg(path)
.exec()?;
Ok(HgRepo)
Expand All @@ -65,6 +66,7 @@ impl PijulRepo {
ProcessBuilder::new("pijul")
.cwd(cwd)
.arg("init")
.arg("--")
.arg(path)
.exec()?;
Ok(PijulRepo)
Expand All @@ -85,13 +87,15 @@ impl FossilRepo {
ProcessBuilder::new("fossil")
.cwd(cwd)
.arg("init")
.arg("--")
.arg(&db_path)
.exec()?;

// open it in that new directory
ProcessBuilder::new("fossil")
.cwd(&path)
.arg("open")
.arg("--")
.arg(db_fname)
.exec()?;

Expand Down

0 comments on commit 1023fa5

Please sign in to comment.