MCPcopy
hub / github.com/claude-code-best/claude-code / getGitState

Function getGitState

src/utils/git.ts:472–502  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

470}
471
472export async function getGitState(): Promise<GitRepoState | null> {
473 try {
474 const [
475 commitHash,
476 branchName,
477 remoteUrl,
478 isHeadOnRemote,
479 isClean,
480 worktreeCount,
481 ] = await Promise.all([
482 getHead(),
483 getBranch(),
484 getRemoteUrl(),
485 getIsHeadOnRemote(),
486 getIsClean(),
487 getWorktreeCount(),
488 ])
489
490 return {
491 commitHash,
492 branchName,
493 remoteUrl,
494 isHeadOnRemote,
495 isClean,
496 worktreeCount,
497 }
498 } catch (_) {
499 // Fail silently - git state is best effort
500 return null
501 }
502}
503
504export async function getGithubRepo(): Promise<string | null> {
505 const { parseGitRemote } = await import('./detectRepository.js')

Callers 1

loadEnvInfoFunction · 0.85

Calls 6

getHeadFunction · 0.85
getBranchFunction · 0.85
getRemoteUrlFunction · 0.85
getIsHeadOnRemoteFunction · 0.85
getIsCleanFunction · 0.85
getWorktreeCountFunction · 0.85

Tested by

no test coverage detected