vcs menu: Use project's repositories, do not open directly (#11652)

I ran into this when trying to get #11550 working: the VCS menu would
open repositories on its owned, based on paths, instead of going through
the worktree on which we already store the git repositories.



Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-05-10 11:06:32 +02:00 committed by GitHub
parent b3dc31d7c9
commit df190ea846
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 37 deletions

View file

@ -7901,6 +7901,16 @@ impl Project {
.local_git_repo(&project_path.path)
}
pub fn get_first_worktree_root_repo(
&self,
cx: &AppContext,
) -> Option<Arc<Mutex<dyn GitRepository>>> {
let worktree = self.visible_worktrees(cx).next()?.read(cx).as_local()?;
let root_entry = worktree.root_git_entry()?;
worktree.get_local_repo(&root_entry)?.repo().clone().into()
}
pub fn blame_buffer(
&self,
buffer: &Model<Buffer>,