Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/PhpGitHooks/Module/Git/Service/CommitMsgTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,16 @@ public function run(InputInterface $input)
if (true === $configurationDataResponse->getCommitMsg()->isCommitMsg()) {
$commitContent = $this->commitMessageFinder->find($input->getFirstArgument());

$validMessage = $this->isValidCommitMessage(
$configurationDataResponse->getCommitMsg()->getRegularExpression(),
$commitContent
);
$regularExpression = $configurationDataResponse->getCommitMsg()->getRegularExpression();
$validMessage = $this->isValidCommitMessage($regularExpression, $commitContent);

if (false === $validMessage) {
throw new InvalidCommitMessageException();
throw new InvalidCommitMessageException(
sprintf(
'Invalid Commit message: commit message does not match regex %s !',
$regularExpression
)
);
}
}
}
Expand Down