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 22:17:57 +02:00 committed by GitHub
parent 0c94bdc8e4
commit e42b6e6905
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 30 deletions

View file

@ -56,6 +56,7 @@ pub struct WorktreeStore {
state: WorktreeStoreState,
}
#[derive(Debug)]
pub enum WorktreeStoreEvent {
WorktreeAdded(Entity<Worktree>),
WorktreeRemoved(EntityId, WorktreeId),