Fix some syncing issues with git statuses (#25535)
Like the real app, this one infinite loops if you have a diff in an UnsharedFile. Release Notes: - N/A *or* Added/Fixed/Improved ... --------- Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
parent
88baf171c3
commit
08539b32d0
11 changed files with 283 additions and 6 deletions
|
@ -827,17 +827,35 @@ impl Worktree {
|
|||
cx.spawn(|this, mut cx| async move {
|
||||
while (snapshot_updated_rx.recv().await).is_some() {
|
||||
this.update(&mut cx, |this, cx| {
|
||||
let mut git_repos_changed = false;
|
||||
let mut entries_changed = false;
|
||||
let this = this.as_remote_mut().unwrap();
|
||||
{
|
||||
let mut lock = this.background_snapshot.lock();
|
||||
this.snapshot = lock.0.clone();
|
||||
if let Some(tx) = &this.update_observer {
|
||||
for update in lock.1.drain(..) {
|
||||
for update in lock.1.drain(..) {
|
||||
if !update.updated_entries.is_empty()
|
||||
|| !update.removed_entries.is_empty()
|
||||
{
|
||||
entries_changed = true;
|
||||
}
|
||||
if !update.updated_repositories.is_empty()
|
||||
|| !update.removed_repositories.is_empty()
|
||||
{
|
||||
git_repos_changed = true;
|
||||
}
|
||||
if let Some(tx) = &this.update_observer {
|
||||
tx.unbounded_send(update).ok();
|
||||
}
|
||||
}
|
||||
};
|
||||
cx.emit(Event::UpdatedEntries(Arc::default()));
|
||||
|
||||
if entries_changed {
|
||||
cx.emit(Event::UpdatedEntries(Arc::default()));
|
||||
}
|
||||
if git_repos_changed {
|
||||
cx.emit(Event::UpdatedGitRepositories(Arc::default()));
|
||||
}
|
||||
cx.notify();
|
||||
while let Some((scan_id, _)) = this.snapshot_subscriptions.front() {
|
||||
if this.observed_snapshot(*scan_id) {
|
||||
|
@ -5451,7 +5469,6 @@ impl BackgroundScanner {
|
|||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
log::trace!(
|
||||
"computed git statuses for repo {repository_name} in {:?}",
|
||||
t0.elapsed()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue