-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathif-unchanged.js
More file actions
executable file
·38 lines (30 loc) · 682 Bytes
/
Copy pathif-unchanged.js
File metadata and controls
executable file
·38 lines (30 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env node
const child_process = require('child_process');
const path = require('path');
const currentPath = path.join(
__dirname,
path.relative(__dirname, process.cwd())
);
console.log('path: ', currentPath);
let result;
try {
result = child_process
.execSync('git diff --name-only origin/master... | cat')
.toString();
} catch (err) {
console.error(err);
process.exit(1);
}
if (result) {
console.log(result);
const dirs = result
.split('\n')
.filter((file) => file)
.map((file) => path.join(__dirname, file));
for (const dir of dirs) {
if (dir.startsWith(currentPath)) {
process.exit(1);
}
}
}
process.exit(0);