Fix TIA fingerprinting inside linked git worktrees - #1813
Open
ademola-emmanuel wants to merge 1 commit into
Open
Fix TIA fingerprinting inside linked git worktrees#1813ademola-emmanuel wants to merge 1 commit into
ademola-emmanuel wants to merge 1 commit into
Conversation
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.
Fixes #1810.
The problem
Fingerprint::isTrackedByGit()answers "is this file gitignored?" with Symfony Finder'signoreVCSIgnored(true). Finder locates the repository root by walking upward until it finds a.gitdirectory. In a linked worktree.gitis a pointer file, so the walk misses the worktree root, and what happens next depends on the directory layout:.gitdirectory (worktrees kept inside the main repository under an ignored.worktrees/directory, or a dotfiles repository in$HOMEthat ignores*), Finder adopts that ancestor as the repository root and applies its ignore rules to the worktree's files. Every structural file then reports as ignored,trackedHash()returns null for all of them, and--tiarebuilds the graph on every run with no error, just a permanent "fresh graph" message.The fix
Ask git itself with
git check-ignore -q, run from the project root, as the issue suggests. Git resolves thegitdir:pointer natively, so worktrees behave like regular clones. This also matches how TIA already answers the same question inChangedFiles::filterIgnored().Exit code 0 keeps a file out of the fingerprint (ignored), 1 keeps it in, and anything else (git missing, not a repository) keeps the file, matching the existing no-
.gitearly return.Verification
.worktrees/directory. On current 5.x it fails (worktree fingerprints are null); with this change the worktree produces the same structural fingerprint as the clone, which is the property replay depends on.