Stop the ignore-file search at the working-tree boundary - #4527
Open
willemkokke wants to merge 1 commit into
Open
Stop the ignore-file search at the working-tree boundary#4527willemkokke wants to merge 1 commit into
willemkokke wants to merge 1 commit into
Conversation
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.
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.) |
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.