fix: use relative paths in isPathInIgnoredDirectory to fix worktree indexing (#11009)

This commit is contained in:
Daniel 2026-01-27 12:43:47 -05:00 committed by GitHub
parent d6d00dedec
commit b9cf163b87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View file

@ -508,8 +508,12 @@ export class FileWatcher implements IFileWatcher {
*/
async processFile(filePath: string): Promise<FileProcessingResult> {
try {
// Get relative path for ignore checks
const relativeFilePath = generateRelativeFilePath(filePath, this.workspacePath)
// Check if file is in an ignored directory
if (isPathInIgnoredDirectory(filePath)) {
// Use relative path to avoid matching parent directories outside the workspace
if (isPathInIgnoredDirectory(relativeFilePath)) {
return {
path: filePath,
status: "skipped" as const,
@ -518,7 +522,6 @@ export class FileWatcher implements IFileWatcher {
}
// Check if file should be ignored
const relativeFilePath = generateRelativeFilePath(filePath, this.workspacePath)
if (
!this.ignoreController.validateAccess(filePath) ||
(this.ignoreInstance && this.ignoreInstance.ignores(relativeFilePath))

View file

@ -96,7 +96,8 @@ export class DirectoryScanner implements IDirectoryScanner {
const relativeFilePath = generateRelativeFilePath(filePath, scanWorkspace)
// Check if file is in an ignored directory using the shared helper
if (isPathInIgnoredDirectory(filePath)) {
// Use relative path to avoid matching parent directories outside the workspace
if (isPathInIgnoredDirectory(relativeFilePath)) {
return false
}