build: make git revert messages valid (#22339)

`git revert` default message is "Revert <original message>" (no semi-colon)

PR Close #22339
This commit is contained in:
Victor Berchet 2018-02-20 17:11:10 -08:00
parent 1c1cbba04b
commit 435f6eecd2
2 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ const configPath = path.resolve(__dirname, './commit-message.json');
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
const PATTERN = /^(\w+)(?:\(([^)]+)\))?\: (.+)$/;
const FIXUP_SQUASH = /^(fixup|squash)\! /i;
const REVERT = /^revert: (\"(.*)\"|(.*))?$/i;
const REVERT = /^revert:? (\"(.*)\"|(.*))?$/i;
module.exports = function(commitSubject) {
commitSubject = commitSubject.replace(FIXUP_SQUASH, '');

View File

@ -45,10 +45,10 @@ describe('validate-commit-message.js', function() {
expect(validateMessage('fixup! release(packaging): something')).toBe(VALID);
expect(validateMessage('squash! release(packaging): something')).toBe(VALID);
expect(validateMessage('Revert: "release(packaging): something"')).toBe(VALID);
expect(validateMessage('Revert "release(packaging): something"')).toBe(VALID);
expect(errors).toEqual([]);
});
it('should fail when scope is invalid', function() {
expect(validateMessage('fix(Compiler): something')).toBe(INVALID);
expect(validateMessage('feat(bah): something')).toBe(INVALID);