MCPcopy Create free account
hub / github.com/Noumena-Network/code / getGitState

Function getGitState

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

Source from the content-addressed store, hash-verified

485}
486
487export async function getGitState(): Promise<GitRepoState | null> {
488 try {
489 const [
490 commitHash,
491 branchName,
492 remoteUrl,
493 isHeadOnRemote,
494 isClean,
495 worktreeCount,
496 ] = await Promise.all([
497 getHead(),
498 getBranch(),
499 getRemoteUrl(),
500 getIsHeadOnRemote(),
501 getIsClean(),
502 getWorktreeCount(),
503 ])
504
505 return {
506 commitHash,
507 branchName,
508 remoteUrl,
509 isHeadOnRemote,
510 isClean,
511 worktreeCount,
512 }
513 } catch (_) {
514 // Fail silently - git state is best effort
515 return null
516 }
517}
518
519export async function getGithubRepo(): Promise<string | null> {
520 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