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

Function isInTransientGitState

src/utils/gitDiff.ts:307–326  ·  view source on GitHub ↗

* Check if we're in a transient git state (merge, rebase, cherry-pick, or revert). * During these operations, we skip diff calculation since the working * tree contains incoming changes that weren't intentionally made. * * Uses fs.access to check for transient ref files, avoiding process spawns.

()

Source from the content-addressed store, hash-verified

305 * Uses fs.access to check for transient ref files, avoiding process spawns.
306 */
307async function isInTransientGitState(): Promise<boolean> {
308 const gitDir = await getGitDir(getCwd())
309 if (!gitDir) return false
310
311 const transientFiles = [
312 'MERGE_HEAD',
313 'REBASE_HEAD',
314 'CHERRY_PICK_HEAD',
315 'REVERT_HEAD',
316 ]
317
318 const results = await Promise.all(
319 transientFiles.map(file =>
320 access(join(gitDir, file))
321 .then(() => true)
322 .catch(() => false),
323 ),
324 )
325 return results.some(Boolean)
326}
327
328/**
329 * Fetch untracked file names (no content reading).

Callers 2

fetchGitDiffFunction · 0.85
fetchGitDiffHunksFunction · 0.85

Calls 2

getGitDirFunction · 0.85
getCwdFunction · 0.85

Tested by

no test coverage detected