Skip to content

Commit

Permalink
fix: handle gitignore outside pkgDirs
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Jan 21, 2022
1 parent 65a8a4c commit 23a65c8
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/shared/localShadowRepo.ts
Expand Up @@ -79,6 +79,7 @@ export class ShadowRepo {
this.logger.debug('initializing git repo');
await this.gitInit();
}
await this.locateIgnoreFiles();
}

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

/**
Expand Down Expand Up @@ -265,17 +265,11 @@ export class ShadowRepo {
dir: this.projectPath,
gitdir: this.gitDir,
trees: [git.WORKDIR()],
// TODO: this can be marginally faster if we limit it to pkgDirs and toplevel project files
// eslint-disable-next-line @typescript-eslint/require-await
map: async (filepath: string) => filepath,
})) as string[]
)
.filter(
(filepath) =>
filepath.includes(gitIgnoreFileName) &&
// can be top-level like '.' (no sep) OR must be in one of the package dirs
(!filepath.includes(path.sep) || this.packageDirs.some((dir) => pathIsInFolder(filepath, dir.name)))
)
.filter((filepath) => filepath.includes(gitIgnoreFileName))
.map((ignoreFile) => path.join(this.projectPath, ignoreFile));
}

Expand Down

0 comments on commit 23a65c8

Please sign in to comment.