worktree: Stop filtering low-frequency .git file events - #62980
Open
Ariestar wants to merge 1 commit into
Open
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @Ariestar on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
Contributor
Have feedback on this plugin? Let's hear it! |
Ariestar
force-pushed
the
fix/git-external-refs
branch
from
August 21, 2026 04:48
74b2d07 to
debb739
Compare
Ariestar
force-pushed
the
fix/git-external-refs
branch
from
August 21, 2026 13:24
debb739 to
e9b519b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The git panel goes stale after git operations performed outside Zed (a terminal, an
agent tool, or a second Zed window). A common report: after
git fetch/git pull/
git commitin the terminal, the panel still shows old ahead/behind counts andmodified-file markers -- even clicking the panel's Fetch action does not update it.
No error is surfaced. See #61273, #60102, #60882.
Root cause
The worktree filters filesystem events inside
.gitdirectories, ignoring "noisy"paths to avoid triggering unnecessary git rescans. That filtering included a
file-name denylist:
Every external git operation writes one of these files exactly once:
FETCH_HEAD(fetch/pull),
ORIG_HEAD(reset/merge),COMMIT_EDITMSG(commit),BISECT_LOG(bisect),
gc.pid(gc). Because those events are dropped, the worktree never bumpsthe repository's
git_dir_scan_id, noUpdatedGitRepositoriesevent is emitted, andthe git store never re-runs
git status— so the panel stays stale indefinitely.When a fetch brings no new refs,
FETCH_HEADis the only signal, sorefs-directory watches (#60660) do not cover this case.Solution
Drop the file-name denylist entirely. Instead of maintaining a list of "which
low-frequency files are worth a rescan", treat every
.gitfile event outside theknown high-frequency directories as worth one git-state check:
COMMIT_EDITMSG,FETCH_HEAD,ORIG_HEAD,BISECT_LOG,gc.pidnow all trigger a rescan).objects/,logs/,fsmonitor-daemon/,lfs/,rebase-*,sequencer/) and the transient-file filtering (*.lock,single-level
*.new/*.tmp). These are either written continuously duringlong-running git operations (fetch/gc), redundant with ref/index events, or
necessary to avoid a rescan self-triggering loop (
index.lock, see the existingcomment in
process_events).This is safe against rescan storms by construction: the denylisted files are each
written once per git operation, and the existing snapshot diff
(
git_dir_scan_idcomparison) already suppressesUpdatedGitRepositorieswhen gitstate is unchanged.
Testing
test_noisy_dot_git_events_do_not_emit_git_repo_update—FETCH_HEAD,ORIG_HEAD,COMMIT_EDITMSG,BISECT_LOG,gc.pidnow assert that events emitUpdatedGitRepositories; object writes, reflogs, lock files,rebase-*andsequencer/events still do not.test_random_git_updates_with_watcher_overflows.Related issues
Release Notes:
git fetch/git pull/git commitperformed outside Zed.