Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix git blame not working correctly with submodules (#10114)

Thorsten Ballc4ceeb715ad1
diff --git a/crates/fs/src/repository.rs b/crates/fs/src/repository.rs
index 806b3a0784a..e1a23911ab3 100644
--- a/crates/fs/src/repository.rs
+++ b/crates/fs/src/repository.rs
@@ -232,10 +232,10 @@ impl GitRepository for RealGitRepository {
}
fn blame(&self, path: &Path, content: Rope) -> Result<git::blame::Blame> {
- let git_dir_path = self.repository.path();
- let working_directory = git_dir_path.parent().with_context(|| {
- format!("failed to get git working directory for {:?}", git_dir_path)
- })?;
+ let working_directory = self
+ .repository
+ .workdir()
+ .with_context(|| format!("failed to get git working directory for file {:?}", path))?;
const REMOTE_NAME: &str = "origin";
let remote_url = self.remote_url(REMOTE_NAME);