Skip to content

Instantly share code, notes, and snippets.

@yanjost
Created March 25, 2015 15:11
Show Gist options
  • Save yanjost/6eb1d9162d527f5c3941 to your computer and use it in GitHub Desktop.
Save yanjost/6eb1d9162d527f5c3941 to your computer and use it in GitHub Desktop.
Check for Redmine issue at commit
#!/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
@yanjost
Copy link
Author

yanjost commented Mar 25, 2015

Add in your repo as .git/hooks/commit-msg

Don't forget to set the executable bit (+x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment