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.

Add some debug logging to understand hangs in the git store's `compute_snapshot` (#57317)

Cole Miller251456cf2088
diff --git a/crates/project/src/git_store.rs b/crates/project/src/git_store.rs
index ee6063c0e4e..ad5174ec365 100644
--- a/crates/project/src/git_store.rs
+++ b/crates/project/src/git_store.rs
@@ -9144,6 +9144,8 @@ async fn compute_snapshot(
backend: Arc<dyn GitRepository>,
cx: &mut AsyncApp,
) -> Result<RepositorySnapshot> {
+ log::debug!("starting compute snapshot");
+
let (id, work_directory_abs_path, prev_snapshot) = this.update(cx, |this, _| {
this.paths_needing_status_update.clear();
(
@@ -9175,6 +9177,7 @@ async fn compute_snapshot(
}
})
.await?;
+ log::debug!("fetched branches, head commit, worktrees");
let branch = branches.iter().find(|branch| branch.is_head).cloned();
let branch_list: Arc<[Branch]> = branches.into();
@@ -9198,6 +9201,8 @@ async fn compute_snapshot(
})
.await?;
+ log::debug!("fetched remotes");
+
let snapshot = this.update(cx, |this, cx| {
let head_changed =
branch != this.snapshot.branch || head_commit != this.snapshot.head_commit;
@@ -9257,6 +9262,7 @@ async fn compute_snapshot(
}
})
.await?;
+ log::debug!("fetched statuses, diff stats, stash entries");
let diff_stat_map: HashMap<&RepoPath, DiffStat> =
diff_stats.entries.iter().map(|(p, s)| (p, *s)).collect();