From e4242b73405c0d2b30a7ca426650049abaa1c4a6 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Mon, 10 Sep 2018 23:06:34 +0200 Subject: [PATCH] fix(is-ignored): use grouped regex to ignore merge commits --- @commitlint/is-ignored/src/index.js | 2 +- @commitlint/is-ignored/src/index.test.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/@commitlint/is-ignored/src/index.js b/@commitlint/is-ignored/src/index.js index 839786d2ab..3d25e236d7 100644 --- a/@commitlint/is-ignored/src/index.js +++ b/@commitlint/is-ignored/src/index.js @@ -3,7 +3,7 @@ import semver from 'semver'; const WILDCARDS = [ c => c.match( - /^(Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?))(?:\r?\n)*$)/ + /^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/ ), c => c.match(/^(R|r)evert (.*)/), c => c.match(/^(fixup|squash)!/), diff --git a/@commitlint/is-ignored/src/index.test.js b/@commitlint/is-ignored/src/index.test.js index f20faef602..961343b646 100644 --- a/@commitlint/is-ignored/src/index.test.js +++ b/@commitlint/is-ignored/src/index.test.js @@ -107,3 +107,7 @@ test('should return true for bitbucket merge commits', t => { test('should return true for automatic merge commits', t => { t.true(isIgnored('Auto-merged develop into master')); }); + +test('should return false for commits containing, but not starting, with merge branch', t => { + t.false(isIgnored('foo bar Merge branch xxx')); +});