Created
March 25, 2015 15:11
-
-
Save yanjost/6eb1d9162d527f5c3941 to your computer and use it in GitHub Desktop.
Check for Redmine issue at commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
message_file = ARGV[0] | |
message = File.read(message_file) | |
$regex = /(refs #(\d+)|fixes #(\d+))/ | |
if !$regex.match(message) && !message.include?("(no issue)") | |
puts "Your message is not formatted correctly (missing refs #XXX or fixes #XXX or '(no issue)' )" | |
exit 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add in your repo as .git/hooks/commit-msg
Don't forget to set the executable bit (+x)