MCPcopy
hub / github.com/garrytan/gstack / gitBranch

Function gitBranch

lib/bin-context.ts:18–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17/** Current git branch, or undefined on detached HEAD / outside a repo. */
18export function gitBranch(): string | undefined {
19 const r = spawnSync("git", ["rev-parse", "--abbrev-ref", "HEAD"], { encoding: "utf-8" });
20 const b = (r.stdout || "").trim();
21 return b && b !== "HEAD" ? b : undefined;
22}
23
24/** The value following `--flag` in argv, or undefined if absent. */
25export function flagValue(args: string[], name: string): string | undefined {

Callers

nothing calls this directly

Calls 1

spawnSyncFunction · 0.85

Tested by

no test coverage detected