Skip to content

Commit 23a65c8

Browse files
committed
fix: handle gitignore outside pkgDirs
1 parent 65a8a4c commit 23a65c8

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/shared/localShadowRepo.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class ShadowRepo {
7979
this.logger.debug('initializing git repo');
8080
await this.gitInit();
8181
}
82+
await this.locateIgnoreFiles();
8283
}
8384

8485
/**
@@ -88,7 +89,6 @@ export class ShadowRepo {
8889
public async gitInit(): Promise<void> {
8990
await fs.promises.mkdir(this.gitDir, { recursive: true });
9091
await git.init({ fs, dir: this.projectPath, gitdir: this.gitDir, defaultBranch: 'main' });
91-
await this.locateIgnoreFiles();
9292
}
9393

9494
/**
@@ -265,17 +265,11 @@ export class ShadowRepo {
265265
dir: this.projectPath,
266266
gitdir: this.gitDir,
267267
trees: [git.WORKDIR()],
268-
// TODO: this can be marginally faster if we limit it to pkgDirs and toplevel project files
269268
// eslint-disable-next-line @typescript-eslint/require-await
270269
map: async (filepath: string) => filepath,
271270
})) as string[]
272271
)
273-
.filter(
274-
(filepath) =>
275-
filepath.includes(gitIgnoreFileName) &&
276-
// can be top-level like '.' (no sep) OR must be in one of the package dirs
277-
(!filepath.includes(path.sep) || this.packageDirs.some((dir) => pathIsInFolder(filepath, dir.name)))
278-
)
272+
.filter((filepath) => filepath.includes(gitIgnoreFileName))
279273
.map((ignoreFile) => path.join(this.projectPath, ignoreFile));
280274
}
281275

0 commit comments

Comments
 (0)