mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
Use -- in more places that call subcommands with paths (#53484)
Thanks to Dario Weißer for the suggestion Release Notes: - Fixed some potential edge cases when paths in a project started with `-`.
This commit is contained in:
parent
f1d9afff66
commit
b8766ef3af
4 changed files with 7 additions and 5 deletions
|
|
@ -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}");
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in a new issue