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

Function isFileDeleted

src/utils/commitAttribution.ts:794–813  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

792 * Check if a file was deleted in the staged changes.
793 */
794export async function isFileDeleted(filePath: string): Promise<boolean> {
795 const cwd = getAttributionRepoRoot()
796
797 try {
798 const result = await execFileNoThrowWithCwd(
799 gitExe(),
800 ['diff', '--cached', '--name-status', '--', filePath],
801 { cwd, timeout: 5000 },
802 )
803
804 if (result.code === 0 && result.stdout) {
805 // Format: "D\tfilename" for deleted files
806 return result.stdout.trim().startsWith('D\t')
807 }
808 } catch {
809 // Ignore errors
810 }
811
812 return false
813}
814
815/**
816 * Get staged files from git.

Callers 1

Calls 2

getAttributionRepoRootFunction · 0.85
execFileNoThrowWithCwdFunction · 0.85

Tested by

no test coverage detected