Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
git: Skip directories in git status output (#23300)
Cole Millerfed4b48c5727
diff --git a/crates/git/src/status.rs b/crates/git/src/status.rsindex ea3af140afd..eed2c28f088 100644--- a/crates/git/src/status.rs+++ b/crates/git/src/status.rs@@ -421,15 +421,15 @@ impl GitStatus {.stdout(Stdio::piped()).stderr(Stdio::piped()).spawn()- .map_err(|e| anyhow!("Failed to start git status process: {}", e))?;+ .map_err(|e| anyhow!("Failed to start git status process: {e}"))?;let output = child.wait_with_output()- .map_err(|e| anyhow!("Failed to read git blame output: {}", e))?;+ .map_err(|e| anyhow!("Failed to read git status output: {e}"))?;if !output.status.success() {let stderr = String::from_utf8_lossy(&output.stderr);- return Err(anyhow!("git status process failed: {}", stderr));+ return Err(anyhow!("git status process failed: {stderr}"));}let stdout = String::from_utf8_lossy(&output.stdout);let mut entries = stdout@@ -440,6 +440,13 @@ impl GitStatus {return None;};let path = &entry[3..];+ // The git status output includes untracked directories as well as untracked files.+ // We do our own processing to compute the "summary" status of each directory,+ // so just skip any directories in the output, since they'll otherwise interfere+ // with our handling of nested repositories.+ if path.ends_with('/') {+ return None;+ }let status = entry[0..2].as_bytes().try_into().unwrap();let status = FileStatus::from_bytes(status).log_err()?;let path = RepoPath(Path::new(path).into());