Skip to content

dir: invalidate parents of stale cached directories - #2321

Open
letmaik wants to merge 1 commit into
gitgitgadget:masterfrom
letmaik:untracked-cache-stale-dirs-parents
Open

letmaik wants to merge 1 commit into
gitgitgadget:masterfrom
letmaik:untracked-cache-stale-dirs-parents

Conversation

@letmaik

@letmaik letmaik commented Nov 20, 2026

Copy link
Copy Markdown

CC: Ilia K ki.stfu@gmail.com, Derrick Stolee stolee@gmail.com, Junio C Hamano gitster@pobox.com

After a failed fsmonitor query or a trivial response, "git status"
can report both an untracked directory and a directory below it,
for example "?? three/" and "?? three/deep/".

1cf98cb (fsmonitor: check the untracked cache after a trivial
response, 2026-11-09) added a stat check before writing the untracked
cache alongside a new fsmonitor token after these responses.  The check
invalidates stale directories, but does not propagate the invalidation
to their parents.

In normal mode, a parent's cached untracked list can contain "three/"
from a check-only scan of the child.  Writing the invalid child clears
its check_only flag.  The next cached walk then recurses into the child
and reports "three/deep/", while the parent's list still reports
"three/".

Invalidate ancestors too when DIR_SHOW_OTHER_DIRECTORIES is set, as
invalidate_one_component() does.  Leave all-files mode unchanged and
reuse the existing traversal without adding stat calls.

Add normal-mode regression tests for failed queries and trivial
responses.  Use fixed directory mtimes and force an index write without
scanning untracked files.

Signed-off-by: Maik Riechert <letmaik@outlook.com>
@letmaik

letmaik commented Nov 20, 2026

Copy link
Copy Markdown
Author

/preview

@gitgitgadget

gitgitgadget Bot commented Nov 20, 2026

Copy link
Copy Markdown

Preview email sent as pull.2321.git.1795152204345.gitgitgadget@gmail.com

@letmaik

letmaik commented Nov 20, 2026

Copy link
Copy Markdown
Author

/submit

@gitgitgadget

gitgitgadget Bot commented Nov 20, 2026

Copy link
Copy Markdown

Submitted as pull.2321.git.1795152783221.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-2321/letmaik/untracked-cache-stale-dirs-parents-v1

To fetch this version to local tag pr-2321/letmaik/untracked-cache-stale-dirs-parents-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-2321/letmaik/untracked-cache-stale-dirs-parents-v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant