(prefix: string)
| 25 | const CLEAN = { added: [], modified: [], removed: [] }; |
| 26 | |
| 27 | function makeRepo(prefix: string): { repo: string; git: (...args: string[]) => string; write: (rel: string, body: string) => void } { |
| 28 | const repo = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), prefix))); |
| 29 | const git = (...args: string[]) => |
| 30 | cp.execFileSync('git', args, { cwd: repo, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }) as string; |
| 31 | const write = (rel: string, body: string) => { |
| 32 | fs.mkdirSync(path.dirname(path.join(repo, rel)), { recursive: true }); |
| 33 | fs.writeFileSync(path.join(repo, rel), body); |
| 34 | }; |
| 35 | git('init', '-q'); |
| 36 | git('config', 'user.email', 'test@example.invalid'); |
| 37 | git('config', 'user.name', 'Test'); |
| 38 | git('config', 'commit.gpgsign', 'false'); |
| 39 | return { repo, git, write }; |
| 40 | } |
| 41 | |
| 42 | /** The `git status` runs made since the last clear, as [cwd, args]. */ |
| 43 | function gitStatusRuns(): Array<[string, string[]]> { |
no test coverage detected