Do less git metadata rescans on FS events (#24034)

A preparation for collaborative commit message editing.

Before, almost any `.git`-contained file FS update, except
`.git/fsmonitor--daemon/cookies/**` caused git metadata rescan.
This included `index.lock` that was created after any git operation,
e.g. `git status`, which was unnecessary.
Collaborative editing aims to share `.git/COMMIT_EDITMSG` between
multiple users, so there are potentially multiple users editing the file
and causing excessive events.

The change makes worktree to ignore .git/COMMIT_EDITMSG`,
`.git/index.lock` and `.git/fsmonitor--daemon/**` paths and adjusts the
logic to be more extensible: there's much more files Zed can ignore and
still have its git metadata up to date.

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov
2025-01-31 20:17:57 +00:00
committed by GitHub
parent 0c94bdc8e4
commit e42b6e6905
3 changed files with 27 additions and 30 deletions
+1
View File
@@ -56,6 +56,7 @@ pub struct WorktreeStore {
state: WorktreeStoreState,
}
#[derive(Debug)]
pub enum WorktreeStoreEvent {
WorktreeAdded(Entity<Worktree>),
WorktreeRemoved(EntityId, WorktreeId),