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

Function isGitTransientState

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

Source from the content-addressed store, hash-verified

842 * Check if we're in a transient git state (rebase, merge, cherry-pick).
843 */
844export async function isGitTransientState(): Promise<boolean> {
845 const gitDir = await resolveGitDir(getAttributionRepoRoot())
846 if (!gitDir) return false
847
848 const indicators = [
849 'rebase-merge',
850 'rebase-apply',
851 'MERGE_HEAD',
852 'CHERRY_PICK_HEAD',
853 'BISECT_LOG',
854 ]
855
856 const results = await Promise.all(
857 indicators.map(async indicator => {
858 try {
859 await stat(join(gitDir, indicator))
860 return true
861 } catch {
862 return false
863 }
864 }),
865 )
866
867 return results.some(exists => exists)
868}
869
870/**
871 * 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