Skip to content

Commit bfbb696

Browse files
authored
perf(fmt): avoid relative resolution on cache hits (#199)
1 parent 616a9ce commit bfbb696

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/rstack/src/fmt/discoverPaths.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,14 @@ class GitIgnoreMatcher {
153153
return loading;
154154
}
155155

156-
#isDirectoryIgnored(
157-
directoryPath: string,
158-
relativePath = path.relative(this.#rootPath, directoryPath),
159-
): boolean {
156+
#isDirectoryIgnored(directoryPath: string, relativePath?: string): boolean {
160157
const cached = this.#ignoredDirectories.get(directoryPath);
161158
if (cached !== undefined) {
162159
return cached;
163160
}
164161

162+
relativePath ??= path.relative(this.#rootPath, directoryPath);
163+
165164
// Git cannot re-include a path below an ignored directory.
166165
const parentPath = path.dirname(directoryPath);
167166
const ignored =

0 commit comments

Comments
 (0)