Skip to content

Stop the ignore-file search at the working-tree boundary - #4527

Open
willemkokke wants to merge 1 commit into
facebook:mainfrom
willemkokke:fix/ignore-file-worktree-boundary
Open

Stop the ignore-file search at the working-tree boundary#4527
willemkokke wants to merge 1 commit into
facebook:mainfrom
willemkokke:fix/ignore-file-worktree-boundary

Conversation

@willemkokke

@willemkokke willemkokke commented Aug 12, 2026

Copy link
Copy Markdown

No description provided.

The upward search for .gitignore/.ignore/.git/info/exclude treated the
directory tree as one hierarchy: from a linked worktree (whose .git is
a gitdir pointer file, not a directory) it sailed past the working-tree
root, found the enclosing checkout's .git/info/exclude, and applied its
patterns rooted at the enclosing checkout. A pattern like
'.claude/worktrees/' in a main checkout's exclude file (how several
agent tools register their worktrees) then matched every file inside
the worktree, and pyrefly skipped all of the project's includes with
'No Python files matched'.

git's own semantics: a directory carrying a .git entry (file or
directory) is a working-tree root; an outer repository's ignore rules
never apply inside it, and the repository's shared info/exclude applies
to each worktree relative to that worktree's own root.

The search now walks upward collecting the nearest .gitignore and
.ignore, stops at the first directory with a .git entry, and resolves
info/exclude through the gitdir pointer and commondir for linked
worktrees -- rooted at the working tree being checked.
@meta-codesync

meta-codesync Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D115778027. (Because this pull request was imported automatically, there will not be any future comments.)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant