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

Function isGitTransientState

src/utils/commitAttribution.ts:784–808  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

782 * Check if we're in a transient git state (rebase, merge, cherry-pick).
783 */
784export async function isGitTransientState(): Promise<boolean> {
785 const gitDir = await resolveGitDir(getAttributionRepoRoot())
786 if (!gitDir) return false
787
788 const indicators = [
789 'rebase-merge',
790 'rebase-apply',
791 'MERGE_HEAD',
792 'CHERRY_PICK_HEAD',
793 'BISECT_LOG',
794 ]
795
796 const results = await Promise.all(
797 indicators.map(async indicator => {
798 try {
799 await stat(join(gitDir, indicator))
800 return true
801 } catch {
802 return false
803 }
804 }),
805 )
806
807 return results.some(exists => exists)
808}
809
810/**
811 * Convert attribution state to snapshot message for persistence.

Callers

nothing calls this directly

Calls 3

resolveGitDirFunction · 0.85
getAttributionRepoRootFunction · 0.85
statFunction · 0.85

Tested by

no test coverage detected