Skip to content

Commit b32bc93

Browse files
dabit1marionebl
authored andcommitted
fix: ignore merge messages with text after newline
* fix(is-ignored): regex not work with newline and extra characters * test(is-ignored): test for newlines with extra characters
1 parent ff0111a commit b32bc93

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

@commitlint/is-ignored/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import semver from 'semver';
33
const WILDCARDS = [
44
c =>
55
c.match(
6-
/^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/
6+
/^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m
77
),
88
c => c.match(/^(R|r)evert (.*)/),
99
c => c.match(/^(fixup|squash)!/),

@commitlint/is-ignored/src/index.test.js

+5
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ test('should return true for merged PRs', t => {
6161
t.true(isIgnored('Merge pull request #369'));
6262
});
6363

64+
test('should return true for branch merges with newline characters and more characters after it', t => {
65+
t.true(isIgnored("Merge branch 'ctrom-YarnBuild'\n "));
66+
t.true(isIgnored("Merge branch 'ctrom-YarnBuild'\r\n # some comment"));
67+
});
68+
6469
test('should return true for revert commits', t => {
6570
t.true(
6671
isIgnored(

0 commit comments

Comments
 (0)