Repository navigation
Conversation
Since ecbc23e (status: modernize git-status "slow untracked files" advice, 2022-11-30), the advice that "git status" gives when enumerating untracked files takes more than 2 seconds adds "but the results were cached, and subsequent runs may be faster" whenever core.fsmonitor is enabled. But it is the untracked cache that caches these results, with or without fsmonitor: - Without the untracked cache, which is off by default, every run enumerates all untracked files again, however fsmonitor is configured, and the promised speedup never comes. - With it, subsequent runs only read the directories that changed, which they find by checking the stat data of all directories, or, with fsmonitor, by asking it. In the Linux kernel repository, on an Apple M4 Pro, enumerating the untracked files takes 305ms when the untracked cache is created, then 17ms with the untracked cache alone, 9ms with fsmonitor as well, and still 313ms with fsmonitor alone. The documentation that ecbc23e added says as much: "While the FSMonitor feature can be enabled without the untracked cache, the benefits are greatly reduced in that case." But the code checks only core.fsmonitor. Give the remark when the untracked cache was used to enumerate the untracked files, whether fsmonitor is enabled or not. Checking core.untrackedCache instead would not be accurate either: the untracked cache is enabled but not used with "--ignored" or a pathspec, and with core.untrackedCache set to "keep", its default, the untracked cache is used if the index already has one. So record in struct wt_status whether dir.untracked is set after fill_directory(), as read_directory() resets it when it cannot use the untracked cache. Signed-off-by: Xing Xin <xingxin.xx@bytedance.com>
blanet
force-pushed
the
xx/status-untracked-cache-advice
branch
from
December 1, 2026 07:18
7deabb9 to
bf68ee0
Compare
Author
|
/submit |
|
Submitted as pull.2345.git.1796112069353.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
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.
No description provided.