mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 02:17:31 +00:00
* fix(git): resolve current branches without tag ambiguity * fix(git): share tag-safe current branch reader with push-target setup and trim real-git proof matrix --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
13 lines
387 B
TypeScript
13 lines
387 B
TypeScript
export async function getGitCurrentBranchName(
|
|
runGit: (args: string[]) => Promise<{ stdout: string }>
|
|
): Promise<string | null> {
|
|
try {
|
|
const { stdout } = await runGit(['symbolic-ref', '--quiet', 'HEAD'])
|
|
const ref = stdout.trim()
|
|
const prefix = 'refs/heads/'
|
|
return ref.startsWith(prefix) ? ref.slice(prefix.length) || null : null
|
|
} catch {
|
|
return null
|
|
}
|
|
}
|