Skip to content

Commit 27ae4ba

Browse files
daniel-lxsq1600822305
authored andcommitted
fix: use relative paths in isPathInIgnoredDirectory to fix worktree indexing (RooCodeInc#11009)
1 parent 6c53f29 commit 27ae4ba

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/services/code-index/processors/file-watcher.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,12 @@ export class FileWatcher implements IFileWatcher {
508508
*/
509509
async processFile(filePath: string): Promise<FileProcessingResult> {
510510
try {
511+
// Get relative path for ignore checks
512+
const relativeFilePath = generateRelativeFilePath(filePath, this.workspacePath)
513+
511514
// Check if file is in an ignored directory
512-
if (isPathInIgnoredDirectory(filePath)) {
515+
// Use relative path to avoid matching parent directories outside the workspace
516+
if (isPathInIgnoredDirectory(relativeFilePath)) {
513517
return {
514518
path: filePath,
515519
status: "skipped" as const,
@@ -518,7 +522,6 @@ export class FileWatcher implements IFileWatcher {
518522
}
519523

520524
// Check if file should be ignored
521-
const relativeFilePath = generateRelativeFilePath(filePath, this.workspacePath)
522525
if (
523526
!this.ignoreController.validateAccess(filePath) ||
524527
(this.ignoreInstance && this.ignoreInstance.ignores(relativeFilePath))

src/services/code-index/processors/scanner.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ export class DirectoryScanner implements IDirectoryScanner {
9696
const relativeFilePath = generateRelativeFilePath(filePath, scanWorkspace)
9797

9898
// Check if file is in an ignored directory using the shared helper
99-
if (isPathInIgnoredDirectory(filePath)) {
99+
// Use relative path to avoid matching parent directories outside the workspace
100+
if (isPathInIgnoredDirectory(relativeFilePath)) {
100101
return false
101102
}
102103

0 commit comments

Comments
 (0)