(filePath: string)
| 732 | * Check if a file was deleted in the staged changes. |
| 733 | */ |
| 734 | export async function isFileDeleted(filePath: string): Promise<boolean> { |
| 735 | const cwd = getAttributionRepoRoot() |
| 736 | |
| 737 | try { |
| 738 | const result = await execFileNoThrowWithCwd( |
| 739 | gitExe(), |
| 740 | ['diff', '--cached', '--name-status', '--', filePath], |
| 741 | { cwd, timeout: 5000 }, |
| 742 | ) |
| 743 | |
| 744 | if (result.code === 0 && result.stdout) { |
| 745 | // Format: "D\tfilename" for deleted files |
| 746 | return result.stdout.trim().startsWith('D\t') |
| 747 | } |
| 748 | } catch { |
| 749 | // Ignore errors |
| 750 | } |
| 751 | |
| 752 | return false |
| 753 | } |
| 754 | |
| 755 | /** |
| 756 | * Get staged files from git. |
no test coverage detected