Skip to content

Commit

Permalink
Fall back to commit.author when commit.committer not present
Browse files Browse the repository at this point in the history
Signed-off-by: bndw <benjamindwoodward@gmail.com>
  • Loading branch information
bndw committed Sep 29, 2017
1 parent e30ed3a commit fdb0f17
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/dco.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ module.exports = function (commits) {
signedOff = false
defaults.failure.description = `The sign-off is missing.`
} else {
if (!validator.validate(commit.committer.email)) {
let email = commit.committer ? commit.committer.email : commit.author.email
let name = commit.committer ? commit.committer.name : commit.author.name

if (!validator.validate(email)) {
signedOff = false
defaults.failure.description = `${commit.committer.email} is not a valid email address.`
defaults.failure.description = `${email} is not a valid email address.`
}
match = regex.exec(commit.message)
if (commit.comitter.name !== match[1] || commit.committer.email !== match[2]) {
if (name !== match[1] || email !== match[2]) {
signedOff = false
defaults.failure.description = `Expected "${commit.committer.name} <${commit.committer.email}>", but got "${match[1]} <${match[2]}>" `
defaults.failure.description = `Expected "${name} <${email}>", but got "${match[1]} <${match[2]}>" `
}
}
}
Expand Down

0 comments on commit fdb0f17

Please sign in to comment.