blob: 484a4d23e7be29bb7c843555ab915c053f1de4e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/usr/bin/env node
const { spawnSync } = require('child_process')
const changes = spawnSync('git', ['status', '--porcelain', '-uno'])
const stdout = changes.stdout.toString('utf8')
const stderr = changes.stderr.toString('utf8')
const { status, signal } = changes
console.log(stdout)
console.error(stderr)
if (status || signal) {
console.error({ status, signal })
process.exitCode = status || 1
}
if (stdout.trim() !== '') {
throw new Error('git dirty')
} else {
console.log('git clean')
}
|