MCPcopy Create free account
hub / github.com/agenticsorg/edge-agents / getCurrentBranch

Function getCurrentBranch

scripts/sparc2/src/git/gitIntegration.ts:373–390  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

371 * @returns The current branch name
372 */
373export async function getCurrentBranch(): Promise<string> {
374 const cmd = new Deno.Command("git", {
375 args: ["rev-parse", "--abbrev-ref", "HEAD"],
376 stdout: "piped",
377 stderr: "piped",
378 });
379
380 const output = await cmd.output();
381 if (!output.success) {
382 const errorOutput = new TextDecoder().decode(output.stderr);
383 await logMessage("error", `Getting current branch failed: ${errorOutput}`);
384 throw new Error(`Getting current branch failed: ${errorOutput}`);
385 }
386
387 const branch = new TextDecoder().decode(output.stdout).trim();
388
389 return branch;
390}
391
392/**
393 * Check if the repository is clean (no uncommitted changes)

Callers 4

applyChangesMethod · 0.90
rollbackChangesFunction · 0.85
revertChangesFunction · 0.85

Calls 1

logMessageFunction · 0.90

Tested by

no test coverage detected