diff --git a/packages/rstack/src/fmt/discoverPaths.ts b/packages/rstack/src/fmt/discoverPaths.ts index acc013d..6eaf826 100644 --- a/packages/rstack/src/fmt/discoverPaths.ts +++ b/packages/rstack/src/fmt/discoverPaths.ts @@ -153,15 +153,14 @@ class GitIgnoreMatcher { return loading; } - #isDirectoryIgnored( - directoryPath: string, - relativePath = path.relative(this.#rootPath, directoryPath), - ): boolean { + #isDirectoryIgnored(directoryPath: string, relativePath?: string): boolean { const cached = this.#ignoredDirectories.get(directoryPath); if (cached !== undefined) { return cached; } + relativePath ??= path.relative(this.#rootPath, directoryPath); + // Git cannot re-include a path below an ignored directory. const parentPath = path.dirname(directoryPath); const ignored =