Commit 0c4d9403 authored by shangbj's avatar shangbj

2

parent 718965bf
console.log('app11.js11');
\ No newline at end of file
console.log('app11.js11');
<<<<<<< HEAD
=====
const execSync = require('child_process').execSync
// git 对所有冲突的地方都会生成下面这种格式的信息,所以写个检测冲突文件的正则
const isConflictRegular = "<<<<<<< HEAD\s"
let results
try {
// git grep 命令会执行 perl 的正则匹配所有满足冲突条件的文件
results = execSync(`git grep -n -P "${isConflictRegular}"`, {encoding: 'utf-8'})
} catch (e) {
console.log('没有发现冲突,等待 commit')
process.exit(0)
}
if(results) {
console.error('发现冲突,请解决后再提交,冲突文件:')
console.error(results.trim())
process.exit(1)
}
process.exit(0)
\ No newline at end of file
......@@ -28,4 +28,4 @@ var path = require('path');
// console.log(' 例如:08-28版本HELLO- frist commit.\n');
// process.exit(1);
// }
// process.exit(0);
\ No newline at end of file
// process.exit(0);
......@@ -15,7 +15,7 @@ const path = require('path')
// console.log('stdout',stdout)
// console.log('stderr',stderr)
// })
console.log('______', process.env.GIT_PUSH_OPTION_COUNT, process.env.GIT_PUSH_OPTION_0)
// console.log('______', process.env, process.env.GIT_PUSH_OPTION_COUNT, process.env.GIT_PUSH_OPTION_0)
// let stream = ''
// if (process.platform === 'win32') {
// // husky不支持配置.git/hooks/xx 中的sh脚本
......
......@@ -12,6 +12,7 @@
},
"husky": {
"hooks": {
"pre-commit": "node ./build/commit.js",
"commit-msg": "node ./build/hooks.js $HUSKY_GIT_PARAMS $HUSKY_GIT_STDIN $GIT_INTERNAL_GETTEXT_SH_SCHEME $GIT_AUTHOR_EMAIL",
"pre-push": "node ./build/push.js $GIT_PUSH_OPTION_COUNT $GIT_PUSH_OPTION_0"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment