dedup repair_worktrees calls

Anthony Eid created

Change summary

crates/fs/src/fake_git_repo.rs  |  4 ----
crates/git/src/repository.rs    | 13 -------------
crates/project/src/git_store.rs | 13 -------------
3 files changed, 30 deletions(-)

Detailed changes

crates/fs/src/fake_git_repo.rs 🔗

@@ -1310,10 +1310,6 @@ impl GitRepository for FakeGitRepository {
         async { Ok(()) }.boxed()
     }
 
-    fn repair_worktrees(&self) -> BoxFuture<'_, Result<()>> {
-        async { Ok(()) }.boxed()
-    }
-
     fn set_trusted(&self, trusted: bool) {
         self.is_trusted
             .store(trusted, std::sync::atomic::Ordering::Release);

crates/git/src/repository.rs 🔗

@@ -923,8 +923,6 @@ pub trait GitRepository: Send + Sync {
 
     fn repair_worktrees(&self) -> BoxFuture<'_, Result<()>>;
 
-    fn repair_worktrees(&self) -> BoxFuture<'_, Result<()>>;
-
     fn set_trusted(&self, trusted: bool);
     fn is_trusted(&self) -> bool;
 }
@@ -2223,17 +2221,6 @@ impl GitRepository for RealGitRepository {
             .boxed()
     }
 
-    fn repair_worktrees(&self) -> BoxFuture<'_, Result<()>> {
-        let git_binary = self.git_binary();
-        self.executor
-            .spawn(async move {
-                let args: Vec<OsString> = vec!["worktree".into(), "repair".into()];
-                git_binary?.run(&args).await?;
-                Ok(())
-            })
-            .boxed()
-    }
-
     fn push(
         &self,
         branch_name: String,

crates/project/src/git_store.rs 🔗

@@ -6174,19 +6174,6 @@ impl Repository {
         })
     }
 
-    pub fn repair_worktrees(&mut self) -> oneshot::Receiver<Result<()>> {
-        self.send_job(None, move |repo, _cx| async move {
-            match repo {
-                RepositoryState::Local(LocalRepositoryState { backend, .. }) => {
-                    backend.repair_worktrees().await
-                }
-                RepositoryState::Remote(_) => {
-                    anyhow::bail!("repair_worktrees is not supported for remote repositories")
-                }
-            }
-        })
-    }
-
     pub fn remove_worktree(&mut self, path: PathBuf, force: bool) -> oneshot::Receiver<Result<()>> {
         let id = self.id;
         self.send_job(