Commit 8b061de1 authored by shangbj's avatar shangbj

update

parents 5b5c73ee 9613b741
...@@ -4,19 +4,17 @@ const chalk = require('chalk') ...@@ -4,19 +4,17 @@ const chalk = require('chalk')
const logSymbols = require('log-symbols') const logSymbols = require('log-symbols')
const execSync = require('child_process').execSync const execSync = require('child_process').execSync
const gitPath = path.join(process.cwd(), '.git/COMMIT_EDITMSG'); const gitPath = path.join(process.cwd(), process.env.HUSKY_GIT_PARAMS);
const mergeMsgPath = path.join(gitPath,'../','MERGE_MSG') const mergeMsgPath = path.join(gitPath,'../','MERGE_MSG')
function mergeCheck(){ function mergeCheck(){
const mergeMsg = fs.readFileSync(mergeMsgPath, 'utf-8');
if(mergeMsg){
console.log(logSymbols.info, chalk.blue('开始分支检测...')) console.log(logSymbols.info, chalk.blue('开始分支检测...'))
const mergeMsg = fs.readFileSync(mergeMsgPath, 'utf-8');
let curBranch = execSync("git symbolic-ref HEAD | sed -e \'s,.*/\(.*\),\1,\'", {encoding: 'utf-8'}) let curBranch = execSync("git symbolic-ref HEAD | sed -e \'s,.*/\(.*\),\1,\'", {encoding: 'utf-8'})
console.log('curBranch', curBranch) console.log('curBranch', curBranch)
console.log('mergeBranch' ,mergeMsg) console.log('mergeBranch' ,mergeMsg)
// process.exit(1) // process.exit(1)
}
} }
function commitMsgCheck(){ function commitMsgCheck(){
...@@ -50,11 +48,11 @@ function conflictCheck() { ...@@ -50,11 +48,11 @@ function conflictCheck() {
} }
} }
// if(fs.existsSync(mergeMsgPath)){ if(fs.existsSync(mergeMsgPath)){
// mergeCheck() mergeCheck()
// } else { } else {
commitMsgCheck() commitMsgCheck()
// } }
conflictCheck() conflictCheck()
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
}, },
"husky": { "husky": {
"hooks": { "hooks": {
"pre-commit": "node ./build/commit-hook.js $HUSKY_GIT_PARAMS", "commit-msg": "node ./build/commit-hook.js $HUSKY_GIT_PARAMS"
"pre-merge-commit": "node ./build/merge-hook.js $HUSKY_GIT_PARAMS"
} }
}, },
"keywords": [], "keywords": [],
......
console.log(1) console.log(1)
console.log(1)
console.log(1)
console.log(1)
\ No newline at end of file
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