Skip to content

Commit

Permalink
Avoid checking for sign offf on merges
Browse files Browse the repository at this point in the history
Signed-off-by: Brandon Keepers <bkeepers@github.com>
  • Loading branch information
bkeepers committed Jul 3, 2017
1 parent 44bdfa4 commit ad13b58
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/dco.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module.exports = commit => {
const signOff = `Signed-off-by: ${commit.author.name} <${commit.author.email}>`;
return commit.message.includes(signOff);
const isMerge = commit.parents && commit.parents.length > 1;
return isMerge || commit.message.includes(signOff(commit));
};

function signOff(commit) {
return `Signed-off-by: ${commit.author.name} <${commit.author.email}>`;
}
13 changes: 13 additions & 0 deletions test/dco.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ describe('dco', () => {
expect(dco(commit)).toBe(true);
});

it('returns true for merge commit', () => {
const commit = {
message: 'mergin stuff',
author: {
name: 'Brandon Keepers',
email: 'bkeepers@github.com'
},
parents: ['commit 1', 'commit 2']
};

expect(dco(commit)).toBe(true);
});

it('returns false if message does not have signoff', () => {
const commit = {
message: 'yolo',
Expand Down

0 comments on commit ad13b58

Please sign in to comment.