| 270 | // the spawned daemon and short-circuit the test. Init it as a git repo |
| 271 | // since the daemon refuses to run outside of one. |
| 272 | function ensureGitRepo(dir) { |
| 273 | try { |
| 274 | execFileSync('git', ['init', '-q'], { cwd: dir, stdio: 'ignore' }); |
| 275 | execFileSync('git', ['config', 'user.email', 'test@example.com'], { cwd: dir, stdio: 'ignore' }); |
| 276 | execFileSync('git', ['config', 'user.name', 'test'], { cwd: dir, stdio: 'ignore' }); |
| 277 | execFileSync('git', ['commit', '--allow-empty', '-m', 'init', '-q'], { cwd: dir, stdio: 'ignore' }); |
| 278 | } catch (_) { /* best-effort */ } |
| 279 | } |
| 280 | |
| 281 | function daemonChildEnv(extraEnv = {}) { |
| 282 | return { |