( filePath: string, cwd: string, )
| 21 | * @param cwd The working directory to run git from |
| 22 | */ |
| 23 | export async function isPathGitignored( |
| 24 | filePath: string, |
| 25 | cwd: string, |
| 26 | ): Promise<boolean> { |
| 27 | const { code } = await execFileNoThrowWithCwd( |
| 28 | 'git', |
| 29 | ['check-ignore', filePath], |
| 30 | { |
| 31 | preserveOutputOnError: false, |
| 32 | cwd, |
| 33 | }, |
| 34 | ) |
| 35 | |
| 36 | return code === 0 |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Gets the path to the global gitignore file (.config/git/ignore) |
no test coverage detected