Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Rename `GitRepository.path()` to `GitRepository.dot_git_dir()` (#22026)
Michael Sloand459f010b607
diff --git a/crates/git/src/repository.rs b/crates/git/src/repository.rsindex 78f6ece508b..b37e517d432 100644--- a/crates/git/src/repository.rs+++ b/crates/git/src/repository.rs@@ -46,7 +46,8 @@ pub trait GitRepository: Send + Sync {fn blame(&self, path: &Path, content: Rope) -> Result<crate::blame::Blame>;- fn path(&self) -> PathBuf;+ /// Returns the path to the repository, typically the `.git` folder.+ fn dot_git_dir(&self) -> PathBuf;}impl std::fmt::Debug for dyn GitRepository {@@ -85,7 +86,7 @@ impl GitRepository for RealGitRepository {}}- fn path(&self) -> PathBuf {+ fn dot_git_dir(&self) -> PathBuf {let repo = self.repository.lock();repo.path().into()}@@ -233,7 +234,7 @@ pub struct FakeGitRepository {#[derive(Debug, Clone)]pub struct FakeGitRepositoryState {- pub path: PathBuf,+ pub dot_git_dir: PathBuf,pub event_emitter: smol::channel::Sender<PathBuf>,pub index_contents: HashMap<PathBuf, String>,pub blames: HashMap<PathBuf, Blame>,@@ -249,9 +250,9 @@ impl FakeGitRepository {}impl FakeGitRepositoryState {- pub fn new(path: PathBuf, event_emitter: smol::channel::Sender<PathBuf>) -> Self {+ pub fn new(dot_git_dir: PathBuf, event_emitter: smol::channel::Sender<PathBuf>) -> Self {FakeGitRepositoryState {- path,+ dot_git_dir,event_emitter,index_contents: Default::default(),blames: Default::default(),@@ -283,9 +284,9 @@ impl GitRepository for FakeGitRepository {None}- fn path(&self) -> PathBuf {+ fn dot_git_dir(&self) -> PathBuf {let state = self.state.lock();- state.path.clone()+ state.dot_git_dir.clone()}fn status(&self, path_prefixes: &[PathBuf]) -> Result<GitStatus> {@@ -334,7 +335,7 @@ impl GitRepository for FakeGitRepository {state.current_branch_name = Some(name.to_owned());state.event_emitter- .try_send(state.path.clone())+ .try_send(state.dot_git_dir.clone()).expect("Dropped repo change event");Ok(())}@@ -344,7 +345,7 @@ impl GitRepository for FakeGitRepository {state.branches.insert(name.to_owned());state.event_emitter- .try_send(state.path.clone())+ .try_send(state.dot_git_dir.clone()).expect("Dropped repo change event");Ok(())}diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rsindex 7b118c1c57e..13f335334ae 100644--- a/crates/worktree/src/worktree.rs+++ b/crates/worktree/src/worktree.rs@@ -3118,7 +3118,7 @@ impl BackgroundScannerState {let t0 = Instant::now();let repository = fs.open_repo(&dot_git_abs_path)?;- let actual_repo_path = repository.path();+ let actual_repo_path = repository.dot_git_dir();let actual_dot_git_dir_abs_path = smol::block_on(find_git_dir(&actual_repo_path, fs))?;watcher.add(&actual_repo_path).log_err()?;