(filePath: string)
| 792 | * Check if a file was deleted in the staged changes. |
| 793 | */ |
| 794 | export 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. |
no test coverage detected