* NUL-delimited status/path pairs for every path committed * between `sinceCommit` and HEAD. Empty when the stamp IS HEAD, which is the * common case — one cheap git call on the hot path.
(repoDir: string, sinceCommit: string)
| 1691 | * common case — one cheap git call on the hot path. |
| 1692 | */ |
| 1693 | function gitCommittedChangesSince(repoDir: string, sinceCommit: string): string[] { |
| 1694 | // NUL framing preserves Unicode, quotes, tabs and newlines in Git paths. |
| 1695 | // Let command failures reach getGitChangedFiles: [] would falsely mean clean. |
| 1696 | const out = execFileSync('git', ['diff', '--relative', '--name-status', '--no-renames', '-z', sinceCommit, 'HEAD', '--', '.'], { |
| 1697 | cwd: repoDir, encoding: 'utf-8', timeout: 10000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true, |
| 1698 | }); |
| 1699 | return out.split('\0'); |
| 1700 | } |
| 1701 | |
| 1702 | /** |
| 1703 | * Can an INDEX trust the git fast path, given the commit it was built at? |