(projectPath: string)
| 64 | } |
| 65 | |
| 66 | export async function getCurrentBranch(projectPath: string): Promise<string | null> { |
| 67 | try { |
| 68 | using proc = execFileAsync("git", ["-C", projectPath, "rev-parse", "--abbrev-ref", "HEAD"]); |
| 69 | const { stdout } = await proc.result; |
| 70 | const branch = stdout.trim(); |
| 71 | if (!branch || branch === "HEAD") { |
| 72 | return null; |
| 73 | } |
| 74 | return branch; |
| 75 | } catch { |
| 76 | return null; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | const FALLBACK_TRUNK_CANDIDATES = ["main", "master", "trunk", "develop", "default"]; |
| 81 |
no test coverage detected