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:
parent
1c1cbba04b
commit
435f6eecd2
|
@ -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, '');
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue