MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / getGitState

Function getGitState

source code/utils/git.ts:474–504  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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