Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async getSubmodules(gitRoot: string) {
const submodules: Submodule[] = []
const gitmodulesPath = join(gitRoot, ".gitmodules")
if (await pathExists(gitmodulesPath)) {
const parsed = await parseGitConfig({ cwd: gitRoot, path: ".gitmodules" })
for (const [key, spec] of Object.entries(parsed || {}) as any) {
if (!key.startsWith("submodule")) {
continue
}
spec.path && submodules.push(spec)
}
}
return submodules
}