function checkMessage(msg) { const msgPattern = preGit.customMsgPattern(); if (msgPattern) { checkMessageAgainstPattern(msg, msgPattern); } const wizard = preGit.wizard(); if (!wizard) { log('no commit message wizard defined'); process.exit(0); } log('found commit message wizard with name', wizard.name); la(check.fn(wizard.validate), 'missing wizard validate method,', Object.keys(wizard)); la(check.fn(preGit.printError), 'missing preGit.printError,', Object.keys(preGit)); log('checking commit message:', msg); const isValid = wizard.validate(msg); if (!isValid) { log('invalid commit message', msg); process.exit(-1); } log('valid git commit message'); }
const pkg = require(pkgPath); const preGit = require('pre-git'); const git = require('ggit'); const chalk = require('chalk'); const log = require('debug')('pre-git'); la(check.fn(log), 'missing debug log', log); /* jshint -W079 */ const Promise = require('bluebird'); const label = 'pre-commit'; const config = pkg.config && pkg.config['pre-git']; const wizard = preGit.wizard(); la(check.maybe.object(wizard), 'could not get commit message wizard', wizard); function getPreCommitCommands(config) { if (!config) { return; } const preCommit = config[label]; if (check.unemptyString(preCommit)) { return [preCommit]; } return preCommit; } function hasPreCommitCommands(config) {