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

Function isInTransientGitState

source code/utils/gitDiff.ts:309–328  ·  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

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