( git: ReturnType<typeof simpleGit>, remoteBranches: string[], )
| 298 | } |
| 299 | |
| 300 | async function getDefaultBranch( |
| 301 | git: ReturnType<typeof simpleGit>, |
| 302 | remoteBranches: string[], |
| 303 | ): Promise<string> { |
| 304 | try { |
| 305 | const headRef = await git.raw(["symbolic-ref", "refs/remotes/origin/HEAD"]); |
| 306 | const match = headRef.match(/refs\/remotes\/origin\/(.+)/); |
| 307 | if (match) { |
| 308 | return match[1].trim(); |
| 309 | } |
| 310 | } catch { |
| 311 | if (remoteBranches.includes("master") && !remoteBranches.includes("main")) { |
| 312 | return "master"; |
| 313 | } |
| 314 | } |
| 315 | return "main"; |
| 316 | } |
| 317 | |
| 318 | async function getCheckedOutBranches( |
| 319 | git: ReturnType<typeof simpleGit>, |
no outgoing calls
no test coverage detected