(cwd: string)
| 210 | } |
| 211 | |
| 212 | export async function getGitBranch(cwd: string): Promise<string | undefined> { |
| 213 | try { |
| 214 | const headPath = path.join(cwd, '.git', 'HEAD'); |
| 215 | const head = await fs.readFile(headPath, 'utf-8'); |
| 216 | const m = head.match(/ref:\s*refs\/heads\/(.+)/); |
| 217 | return m?.[1]?.trim(); |
| 218 | } catch { |
| 219 | return undefined; |
| 220 | } |
| 221 | } |
no outgoing calls
no test coverage detected