lib/commit_hook.rb in git-commit-notifier-0.5.0 vs lib/commit_hook.rb in git-commit-notifier-0.6.1
- old
+ new
@@ -16,12 +16,15 @@
puts "\n"
puts "************** GIT NOTIFIER PROBLEM *******************"
end
def self.run(config, rev1, rev2, ref_name)
+ @config = {}
+ @config = YAML::load_file(config) if File.exist?(config)
+
project_path = Dir.getwd
- recipient = Git.mailing_list_address
+ recipient = @config["mailinglist"] || Git.mailing_list_address
if (recipient.nil? || recipient.length == 0)
CommitHook.show_error(
"Please add a recipient for the emails. Eg : \n" +
" git config hooks.mailinglist developer@example.com")
@@ -29,16 +32,13 @@
end
puts "Sending mail..."
STDOUT.flush
- prefix = Git.repo_name
+ prefix = @config["emailprefix"] || Git.repo_name
branch_name = (ref_name =~ /master$/i) ? "" : "/#{ref_name.split("/").last}"
- @config = {}
- @config = YAML::load_file(config) if File.exist?(config)
-
- diff2html = DiffToHtml.new(Dir.pwd)
+ diff2html = DiffToHtml.new(Dir.pwd, @config)
diff2html.diff_between_revisions rev1, rev2, prefix, ref_name
diffresult = diff2html.result
if (@config["ignore_merge"])