MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / getGitBranch

Function getGitBranch

src/context/tree.ts:212–221  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

210}
211
212export async function getGitBranch(cwd: string): Promise<string | undefined> {
213 try {
214 const headPath = path.join(cwd, '.git', 'HEAD');
215 const head = await fs.readFile(headPath, 'utf-8');
216 const m = head.match(/ref:\s*refs\/heads\/(.+)/);
217 return m?.[1]?.trim();
218 } catch {
219 return undefined;
220 }
221}

Callers 2

index.tsFile · 0.85
buildInitialMessagesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected