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