Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Use -- in more places that call subcommands with paths (#53484)
Conrad Irwinb8766ef3af89
diff --git a/crates/dev_container/src/docker.rs b/crates/dev_container/src/docker.rsindex c02bafb195a..99ce7422eee 100644--- a/crates/dev_container/src/docker.rs+++ b/crates/dev_container/src/docker.rs@@ -196,7 +196,7 @@ impl Docker {async fn pull_image(&self, image: &String) -> Result<(), DevContainerError> {let mut command = Command::new(&self.docker_cli);- command.args(&["pull", image]);+ command.args(&["pull", "--", image]);let output = command.output().await.map_err(|e| {log::error!("Error pulling image: {e}");diff --git a/crates/git/src/blame.rs b/crates/git/src/blame.rsindex 76e622fd6d7..7597e29aee8 100644--- a/crates/git/src/blame.rs+++ b/crates/git/src/blame.rs@@ -58,7 +58,7 @@ async fn run_git_blame(let mut child = {let span = ztracing::debug_span!("spawning git-blame command", path = path.as_unix_str());let _enter = span.enter();- git.build_command(&["blame", "--incremental", "--contents", "-"])+ git.build_command(&["blame", "--incremental", "--contents", "-", "--"]).arg(path.as_unix_str()).stdin(Stdio::piped()).stdout(Stdio::piped())diff --git a/crates/git/src/repository.rs b/crates/git/src/repository.rsindex 6d17641c6ef..b1b9af106d9 100644--- a/crates/git/src/repository.rs+++ b/crates/git/src/repository.rs@@ -1462,7 +1462,7 @@ impl GitRepository for RealGitRepository {log::debug!("indexing SHA: {sha}, path {path:?}");let output = git- .build_command(&["update-index", "--add", "--cacheinfo", mode, sha])+ .build_command(&["update-index", "--add", "--cacheinfo", mode, sha, "--"]).envs(env.iter()).arg(path.as_unix_str()).output()@@ -1476,7 +1476,7 @@ impl GitRepository for RealGitRepository {} else {log::debug!("removing path {path:?} from the index");let output = git- .build_command(&["update-index", "--force-remove"])+ .build_command(&["update-index", "--force-remove", "--"]).envs(env.iter()).arg(path.as_unix_str()).output()@@ -2114,7 +2114,7 @@ impl GitRepository for RealGitRepository {.spawn(async move {let git = git_binary?;let output = git- .build_command(&["stash", "push", "--quiet", "--include-untracked"])+ .build_command(&["stash", "push", "--quiet", "--include-untracked", "--"]).envs(env.iter()).args(paths.iter().map(|p| p.as_unix_str())).output()@@ -3146,6 +3146,7 @@ fn git_status_args(path_prefixes: &[RepoPath]) -> Vec<OsString> {OsString::from("--untracked-files=all"),OsString::from("--no-renames"),OsString::from("-z"),+ OsString::from("--"),];args.extend(path_prefixes.iter().map(|path_prefix| {if path_prefix.is_empty() {diff --git a/crates/gpui_macos/src/platform.rs b/crates/gpui_macos/src/platform.rsindex 291eec54df4..c0f721842a5 100644--- a/crates/gpui_macos/src/platform.rs+++ b/crates/gpui_macos/src/platform.rs@@ -858,6 +858,7 @@ impl Platform for MacPlatform {.background_executor.spawn(async move {if let Some(mut child) = new_command("open")+ .arg("--").arg(path).spawn().context("invoking open command")