Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix flickering when staging and unstaging files (#27931)

Cole Millere1a8a31fa400
diff --git a/crates/editor/src/git/blame.rs b/crates/editor/src/git/blame.rs
index 87fa8d13b3c..a6485c4cf67 100644
--- a/crates/editor/src/git/blame.rs
+++ b/crates/editor/src/git/blame.rs
@@ -212,7 +212,7 @@ impl GitBlame {
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::RepositoryUpdated(_, RepositoryEvent::Updated { .. }, _)
| GitStoreEvent::RepositoryAdded(_)
| GitStoreEvent::RepositoryRemoved(_) => {
log::debug!("Status of git repositories updated. Regenerating blame data...",);
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index 9c2e801ada4..2d662a5a2c1 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -408,8 +408,12 @@ impl GitPanel {
this.active_repository = git_store.read(cx).active_repository();
this.schedule_update(true, window, cx);
}
- GitStoreEvent::RepositoryUpdated(_, RepositoryEvent::Updated, true) => {
- this.schedule_update(true, window, cx);
+ GitStoreEvent::RepositoryUpdated(
+ _,
+ RepositoryEvent::Updated { full_scan },
+ true,
+ ) => {
+ this.schedule_update(*full_scan, window, cx);
}
GitStoreEvent::RepositoryUpdated(_, _, _) => {}
GitStoreEvent::RepositoryAdded(_) | GitStoreEvent::RepositoryRemoved(_) => {
diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs
index 697e2e4277b..fac11a5aa37 100644
--- a/crates/git_ui/src/project_diff.rs
+++ b/crates/git_ui/src/project_diff.rs
@@ -154,7 +154,7 @@ impl ProjectDiff {
window,
move |this, _git_store, event, _window, _cx| match event {
GitStoreEvent::ActiveRepositoryChanged(_)
- | GitStoreEvent::RepositoryUpdated(_, RepositoryEvent::Updated, true) => {
+ | GitStoreEvent::RepositoryUpdated(_, RepositoryEvent::Updated { .. }, true) => {
*this.update_needed.borrow_mut() = ();
}
_ => {}
diff --git a/crates/project/src/git_store.rs b/crates/project/src/git_store.rs
index f5ccf939478..a58cc699bf5 100644
--- a/crates/project/src/git_store.rs
+++ b/crates/project/src/git_store.rs
@@ -258,7 +258,7 @@ pub enum RepositoryState {
#[derive(Clone, Debug)]
pub enum RepositoryEvent {
- Updated,
+ Updated { full_scan: bool },
MergeHeadsChanged,
}
@@ -3521,7 +3521,7 @@ impl Repository {
if update.is_last_update {
self.snapshot.scan_id = update.scan_id;
}
- cx.emit(RepositoryEvent::Updated);
+ cx.emit(RepositoryEvent::Updated { full_scan: true });
Ok(())
}
@@ -3866,7 +3866,7 @@ impl Repository {
.ok();
}
}
- cx.emit(RepositoryEvent::Updated);
+ cx.emit(RepositoryEvent::Updated { full_scan: false });
})
},
);
@@ -4106,7 +4106,7 @@ async fn compute_snapshot(
|| branch != prev_snapshot.branch
|| statuses_by_path != prev_snapshot.statuses_by_path
{
- events.push(RepositoryEvent::Updated);
+ events.push(RepositoryEvent::Updated { full_scan: true });
}
let mut current_merge_conflicts = TreeSet::default();