Finish removing git repository state and scanning logic from worktrees (#27568)
This PR completes the process of moving git repository state storage and scanning logic from the worktree crate to `project::git_store`. Release Notes: - N/A --------- Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com> Co-authored-by: Conrad <conrad@zed.dev>
This commit is contained in:
parent
8f25251faf
commit
e7290df02b
39 changed files with 3121 additions and 3529 deletions
|
@ -12,7 +12,10 @@ use gpui::{
|
|||
};
|
||||
use language::{Bias, Buffer, BufferSnapshot, Edit};
|
||||
use multi_buffer::RowInfo;
|
||||
use project::{Project, ProjectItem, git_store::Repository};
|
||||
use project::{
|
||||
Project, ProjectItem,
|
||||
git_store::{GitStoreEvent, Repository, RepositoryEvent},
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
use std::{sync::Arc, time::Duration};
|
||||
use sum_tree::SumTree;
|
||||
|
@ -202,13 +205,21 @@ impl GitBlame {
|
|||
this.generate(cx);
|
||||
}
|
||||
}
|
||||
project::Event::GitStateUpdated => {
|
||||
_ => {}
|
||||
}
|
||||
});
|
||||
|
||||
let git_store = project.read(cx).git_store().clone();
|
||||
let git_store_subscription =
|
||||
cx.subscribe(&git_store, move |this, _, event, cx| match event {
|
||||
GitStoreEvent::RepositoryUpdated(_, RepositoryEvent::Updated, _)
|
||||
| GitStoreEvent::RepositoryAdded(_)
|
||||
| GitStoreEvent::RepositoryRemoved(_) => {
|
||||
log::debug!("Status of git repositories updated. Regenerating blame data...",);
|
||||
this.generate(cx);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
let buffer_snapshot = buffer.read(cx).snapshot();
|
||||
let buffer_edits = buffer.update(cx, |buffer, _| buffer.subscribe());
|
||||
|
@ -226,7 +237,11 @@ impl GitBlame {
|
|||
task: Task::ready(Ok(())),
|
||||
generated: false,
|
||||
regenerate_on_edit_task: Task::ready(Ok(())),
|
||||
_regenerate_subscriptions: vec![buffer_subscriptions, project_subscription],
|
||||
_regenerate_subscriptions: vec![
|
||||
buffer_subscriptions,
|
||||
project_subscription,
|
||||
git_store_subscription,
|
||||
],
|
||||
};
|
||||
this.generate(cx);
|
||||
this
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue