* Check if a file exists within a worktree. * * Returns false for non-existent files, symlink escapes, and validation failures.
(worktreePath: string, filePath: string)
| 419 | * Returns false for non-existent files, symlink escapes, and validation failures. |
| 420 | */ |
| 421 | async exists(worktreePath: string, filePath: string): Promise<boolean> { |
| 422 | try { |
| 423 | assertRegisteredWorktree(worktreePath); |
| 424 | const fullPath = resolvePathInWorktree(worktreePath, filePath); |
| 425 | await assertRealpathInWorktree(worktreePath, fullPath); |
| 426 | await stat(fullPath); |
| 427 | return true; |
| 428 | } catch { |
| 429 | return false; |
| 430 | } |
| 431 | }, |
| 432 | |
| 433 | /** |
| 434 | * Check if a file is a symlink that points outside the worktree. |
nothing calls this directly
no test coverage detected