Directly parse .git when it's a file instead of using libgit2 (#27885)
Avoids building a whole git2 repository object at the worktree layer just to watch some additional paths. - [x] Tidy up names of the various paths - [x] Tests for worktrees and submodules Release Notes: - N/A
This commit is contained in:
parent
429d4580cf
commit
055df30757
7 changed files with 401 additions and 160 deletions
|
@ -48,6 +48,8 @@ use debugger::{
|
|||
session::Session,
|
||||
};
|
||||
pub use environment::ProjectEnvironment;
|
||||
#[cfg(test)]
|
||||
use futures::future::join_all;
|
||||
use futures::{
|
||||
StreamExt,
|
||||
channel::mpsc::{self, UnboundedReceiver},
|
||||
|
@ -4808,6 +4810,30 @@ impl Project {
|
|||
&self.git_store
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn git_scans_complete(&self, cx: &Context<Self>) -> Task<()> {
|
||||
cx.spawn(async move |this, cx| {
|
||||
let scans_complete = this
|
||||
.read_with(cx, |this, cx| {
|
||||
this.worktrees(cx)
|
||||
.filter_map(|worktree| Some(worktree.read(cx).as_local()?.scan_complete()))
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.unwrap();
|
||||
join_all(scans_complete).await;
|
||||
let barriers = this
|
||||
.update(cx, |this, cx| {
|
||||
let repos = this.repositories(cx).values().cloned().collect::<Vec<_>>();
|
||||
repos
|
||||
.into_iter()
|
||||
.map(|repo| repo.update(cx, |repo, _| repo.barrier()))
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.unwrap();
|
||||
join_all(barriers).await;
|
||||
})
|
||||
}
|
||||
|
||||
pub fn active_repository(&self, cx: &App) -> Option<Entity<Repository>> {
|
||||
self.git_store.read(cx).active_repository()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue