Skip to content

Commit

Permalink
fix: ignore merge messages with text after newline
Browse files Browse the repository at this point in the history
* fix(is-ignored): regex not work with newline and extra characters

* test(is-ignored): test for newlines with extra characters
  • Loading branch information
dabit1 authored and marionebl committed Oct 5, 2018
1 parent ff0111a commit b32bc93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion @commitlint/is-ignored/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)*$)/m
),
c => c.match(/^(R|r)evert (.*)/),
c => c.match(/^(fixup|squash)!/),
Expand Down
5 changes: 5 additions & 0 deletions @commitlint/is-ignored/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ test('should return true for merged PRs', t => {
t.true(isIgnored('Merge pull request #369'));
});

test('should return true for branch merges with newline characters and more characters after it', t => {
t.true(isIgnored("Merge branch 'ctrom-YarnBuild'\n "));
t.true(isIgnored("Merge branch 'ctrom-YarnBuild'\r\n # some comment"));
});

test('should return true for revert commits', t => {
t.true(
isIgnored(
Expand Down

0 comments on commit b32bc93

Please sign in to comment.