MCPcopy Index your code
hub / github.com/codeaashu/claude-code / isFileDeleted

Function isFileDeleted

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 2

getAttributionRepoRootFunction · 0.85
execFileNoThrowWithCwdFunction · 0.85

Tested by

no test coverage detected