Skip to content

Instantly share code, notes, and snippets.

@hechien
Created May 23, 2011 06:51
Show Gist options
  • Save hechien/986331 to your computer and use it in GitHub Desktop.
Save hechien/986331 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# PHP version: http://www.josephj.com/entry.php?id=346
EMAILS_CONFIG_FILE = File.join(File.dirname(__FILE__), "..", "emails")
if(File.exist?(EMAILS_CONFIG_FILE))
emails = File.read(EMAILS_CONFIG_FILE).split("\n").join(", ")
`git config hooks.mailinglist "#{emails}"`
puts "E-mail receivers: #{emails}"
end
branch = ARGF.read.rstrip.split(" ")
last_commiter = `git log -1 --pretty=format:%ae HEAD`
`git config hooks.envelopesender #{last_commiter}`
`echo "#{branch[0].to_s + " " + branch[1].to_s + " " +branch[2].to_s} " | #{File.dirname(__FILE__)}/post-receive-email`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment