Skip to content

Commit b5d798f

Browse files
committed
Add Committer: field to the mail
1 parent 42d9d86 commit b5d798f

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

lib/git_commit_notifier/diff_to_html.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,21 @@ def extract_diff_from_git_show_output(content)
313313
end
314314

315315
def extract_commit_info_from_git_show_output(content)
316-
result = { :message => [], :commit => '', :author => '', :date => '', :email => '' }
316+
result = { :message => [], :commit => '', :author => '', :date => '', :email => '',
317+
:committer => '', :commit_date => '', :committer_email => ''}
317318
content.split("\n").each do |line|
318319
if line =~ /^diff/ # end of commit info, return results
319320
return result
320-
elsif line =~ /^commit/
321+
elsif line =~ /^commit /
321322
result[:commit] = line[7..-1]
322-
elsif line =~ /^Author/
323+
elsif line =~ /^Author:/
323324
result[:author], result[:email] = author_name_and_email(line[8..-1])
324-
elsif line =~ /^Date/
325+
elsif line =~ /^AuthorDate:/
325326
result[:date] = line[8..-1]
327+
elsif line =~ /^Commit:/
328+
result[:commitauthor], result[:commit_email] = author_name_and_email(line[8..-1])
329+
elsif line =~ /^CommitDate:/
330+
result[:commit_date] = line[8..-1]
326331
elsif line =~ /^Merge/
327332
result[:merge] = line[7..-1]
328333
else
@@ -458,6 +463,8 @@ def diff_for_commit(commit)
458463
title += "<strong>Branch:</strong> #{CGI.escapeHTML(branch_name)}\n<br />"
459464
title += "<strong>Date:</strong> #{CGI.escapeHTML commit_info[:date]}\n<br />"
460465
title += "<strong>Author:</strong> #{CGI.escapeHTML(commit_info[:author])} &lt;#{commit_info[:email]}&gt;\n</div>"
466+
title += "<strong>Committer:</strong> #{CGI.escapeHTML(commit_info[:committer])} &lt;#{commit_info[:commit_email]}&gt;\n</div>"
467+
461468
text = "#{raw_diff}"
462469
text += "#{changed_files}\n\n\n"
463470

lib/git_commit_notifier/git.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ def from_shell(cmd)
88

99
def show(rev, ignore_whitespace)
1010
gitopt = ""
11+
gitopt += " --pretty=fuller"
1112
gitopt += " -w" if ignore_whitespace
1213
from_shell("git show #{rev.strip}#{gitopt}")
1314
end
1415

1516
def log(rev1, rev2)
16-
from_shell("git log #{rev1}..#{rev2}").strip
17+
from_shell("git log --pretty=fuller #{rev1}..#{rev2}").strip
1718
end
1819

1920
def changed_files(rev1, rev2)

0 commit comments

Comments
 (0)