MCPcopy Create free account
hub / github.com/cloudflare/computer / currentBranchWith

Function currentBranchWith

packages/computer/src/git/reads.ts:333–348  ·  view source on GitHub ↗
(opts: CurrentBranchWithDeps)

Source from the content-addressed store, hash-verified

331 * HEAD (matching `git symbolic-ref -q HEAD`'s exit-1 case).
332 */
333export async function currentBranchWith(opts: CurrentBranchWithDeps): Promise<string | undefined> {
334 const dir = opts.dir ?? "/";
335 try {
336 const name = await opts.git.currentBranch({
337 fs: opts.fs,
338 dir,
339 fullname: opts.fullname,
340 });
341 return name ?? undefined;
342 } catch (cause) {
343 if (isNotARepositoryCause(cause)) throw new NotARepositoryError(dir, { cause });
344 throw new GitError("ECURRENTBRANCHFAIL", `git symbolic-ref failed: ${errorMessage(cause)}`, {
345 cause,
346 });
347 }
348}
349
350// ---------------------------------------------------------------
351// ls-files

Callers 2

currentBranchFunction · 0.85
reads.test.tsFile · 0.85

Calls 3

isNotARepositoryCauseFunction · 0.85
errorMessageFunction · 0.70
currentBranchMethod · 0.65

Tested by

no test coverage detected