git-commit-mailer 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +11 -11
- data/{license → doc/text}/GPL-3.txt +0 -0
- data/doc/text/news.md +18 -0
- data/lib/git-commit-mailer/commit-info.rb +9 -5
- data/lib/git-commit-mailer/html-mail-body-formatter.rb +60 -5
- data/lib/git-commit-mailer/mail-body-formatter.rb +0 -32
- data/lib/git-commit-mailer/push-info.rb +1 -1
- data/lib/git-commit-mailer/version.rb +1 -1
- data/lib/git-commit-mailer.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c8f402644de43c9b76f2631aef1603d127d3f12
|
4
|
+
data.tar.gz: 8306e844d78ee136b1d499f9b9a73d033dcf83c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1a33c639872bbc62c88c86cc4300bba9e6e4e9dcb8c6c32f1acfd619c43dbfc9d3258862a0619d9372f3369e890595f0a9378a56fe7e7dd2deb021673d9085a
|
7
|
+
data.tar.gz: 223867affd7a3ab35163af1d1528cb19d9c2ad480dd3d0f3d7c2a29ac1dcc76dfe881d1177cd203b842e167ad5671ffeb02391b620a89824e73707abf32674f9
|
data/LICENSE
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
GPLv3 or later. See doc/text/GPL-3.txt for details.
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# GitCommitMailer
|
4
4
|
|
5
|
-
A utility to send commit mails for commits pushed to
|
5
|
+
A utility to send commit mails for commits pushed to Git repositories.
|
6
6
|
|
7
7
|
See also [Git](http://git-scm.com/).
|
8
8
|
|
@@ -15,12 +15,12 @@ See also [Git](http://git-scm.com/).
|
|
15
15
|
## License
|
16
16
|
|
17
17
|
GitCommitMailer is licensed under GPLv3 or later. See
|
18
|
-
|
18
|
+
doc/text/GPL-3.txt for details.
|
19
19
|
|
20
20
|
## Dependencies
|
21
21
|
|
22
|
-
* Ruby >=
|
23
|
-
*
|
22
|
+
* Ruby >= 1.9.3
|
23
|
+
* Git >= 1.7
|
24
24
|
|
25
25
|
## Install
|
26
26
|
|
@@ -28,20 +28,20 @@ license/GPL-3.txt for details.
|
|
28
28
|
$ gem install git-commit-mailer
|
29
29
|
~~~
|
30
30
|
|
31
|
-
git-commit-mailer utilizes
|
31
|
+
git-commit-mailer utilizes Git's hook functionality to send
|
32
32
|
commit mails.
|
33
33
|
|
34
34
|
Edit "post-receive" shell script file to execute it from there,
|
35
|
-
which is located under "hooks" directory in a
|
35
|
+
which is located under "hooks" directory in a Git repository.
|
36
36
|
|
37
37
|
Example:
|
38
38
|
|
39
39
|
~~~
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
git-commit-mailer \
|
41
|
+
--from-domain=example.com \
|
42
|
+
--error-to=onodera@example.com \
|
43
|
+
commit@example.com
|
44
44
|
~~~
|
45
45
|
|
46
|
-
For more detailed usage and options, execute commit-
|
46
|
+
For more detailed usage and options, execute git-commit-mailer
|
47
47
|
with `--help` option.
|
File without changes
|
data/doc/text/news.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# News
|
2
|
+
|
3
|
+
## 1.0.1 - 2015-06-09 {#version-1-0-1}
|
4
|
+
|
5
|
+
GitHub support improvement release!
|
6
|
+
|
7
|
+
### Improvements
|
8
|
+
|
9
|
+
* Supported GitHub issue link by `#NNN` form in commit message.
|
10
|
+
* Followed line number link change in commit page on GitHub.
|
11
|
+
|
12
|
+
### Fixes
|
13
|
+
|
14
|
+
* Fixed message ID duplication problem in merge commits.
|
15
|
+
|
16
|
+
## 1.0.0 - 2015-05-23 {#version-1-0-0}
|
17
|
+
|
18
|
+
The initial release!
|
@@ -46,7 +46,7 @@ class GitCommitMailer
|
|
46
46
|
attr_reader :subject, :author_name, :author_email, :date, :summary
|
47
47
|
attr_accessor :merge_status
|
48
48
|
attr_writer :reference
|
49
|
-
attr_reader :
|
49
|
+
attr_reader :merge_commits
|
50
50
|
def initialize(mailer, reference, revision)
|
51
51
|
@mailer = mailer
|
52
52
|
@reference = reference
|
@@ -65,7 +65,7 @@ class GitCommitMailer
|
|
65
65
|
parse_diff
|
66
66
|
|
67
67
|
@merge_status = []
|
68
|
-
@
|
68
|
+
@merge_commits = []
|
69
69
|
end
|
70
70
|
|
71
71
|
def first_parent
|
@@ -85,7 +85,11 @@ class GitCommitMailer
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def message_id
|
88
|
-
|
88
|
+
if merge?
|
89
|
+
"<merge.#{@parent_revisions.first}.#{@revision}@#{self.class.host_name}>"
|
90
|
+
else
|
91
|
+
"<#{@revision}@#{self.class.host_name}>"
|
92
|
+
end
|
89
93
|
end
|
90
94
|
|
91
95
|
def headers
|
@@ -102,8 +106,8 @@ class GitCommitMailer
|
|
102
106
|
|
103
107
|
def related_mail_headers
|
104
108
|
headers = []
|
105
|
-
@
|
106
|
-
merge_message_id =
|
109
|
+
@merge_commits.each do |merge_commit|
|
110
|
+
merge_message_id = merge_commit.message_id
|
107
111
|
headers << "References: #{merge_message_id}"
|
108
112
|
headers << "In-Reply-To: #{merge_message_id}"
|
109
113
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
# Copyright (C) 2009 Ryo Onodera <onodera@clear-code.com>
|
4
|
-
# Copyright (C) 2012-
|
4
|
+
# Copyright (C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
|
5
5
|
#
|
6
6
|
# This program is free software: you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU General Public License as published by
|
@@ -16,6 +16,8 @@
|
|
16
16
|
# You should have received a copy of the GNU General Public License
|
17
17
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
|
19
|
+
require "digest/md5"
|
20
|
+
|
19
21
|
class GitCommitMailer
|
20
22
|
class HTMLMailBodyFormatter < MailBodyFormatter
|
21
23
|
include ERB::Util
|
@@ -27,7 +29,7 @@ class GitCommitMailer
|
|
27
29
|
|
28
30
|
private
|
29
31
|
def template
|
30
|
-
<<-
|
32
|
+
<<-TEMPLATE
|
31
33
|
<!DOCTYPE html>
|
32
34
|
<html>
|
33
35
|
<head>
|
@@ -51,7 +53,7 @@ class GitCommitMailer
|
|
51
53
|
</dd>
|
52
54
|
<% end %>
|
53
55
|
<%= dt("Message") %>
|
54
|
-
<%= dd(
|
56
|
+
<%= dd(format_summary(@info.summary.strip)) %>
|
55
57
|
<%= format_files("Added", @info.added_files) %>
|
56
58
|
<%= format_files("Copied", @info.copied_files) %>
|
57
59
|
<%= format_files("Removed", @info.deleted_files) %>
|
@@ -63,7 +65,7 @@ class GitCommitMailer
|
|
63
65
|
<%= format_diffs %>
|
64
66
|
</body>
|
65
67
|
</html>
|
66
|
-
|
68
|
+
TEMPLATE
|
67
69
|
end
|
68
70
|
|
69
71
|
def format_revision
|
@@ -209,6 +211,22 @@ EOT
|
|
209
211
|
[from_line_column, to_line_column, content_column]
|
210
212
|
end
|
211
213
|
|
214
|
+
def format_summary(summary)
|
215
|
+
case @mailer.repository_browser
|
216
|
+
when "github"
|
217
|
+
linked_summary = h(summary).gsub(/\#(\d+)/) do
|
218
|
+
%Q(<a href="#{github_issue_url($1)}">\##{$1}</a>)
|
219
|
+
end
|
220
|
+
pre(linked_summary)
|
221
|
+
else
|
222
|
+
pre(h(summary))
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
def github_issue_url(id)
|
227
|
+
"#{@mailer.github_base_url}/#{@mailer.github_user}/#{@mailer.github_repository}/issues/#{id}"
|
228
|
+
end
|
229
|
+
|
212
230
|
def tag_start(name, attributes)
|
213
231
|
start_tag = "<#{name}"
|
214
232
|
unless attributes.empty?
|
@@ -431,7 +449,12 @@ EOT
|
|
431
449
|
|
432
450
|
def span_line_number_hunk_header(file_path, direction, offset)
|
433
451
|
content = "..."
|
434
|
-
|
452
|
+
if offset <= 1
|
453
|
+
offset_omitted = nil
|
454
|
+
else
|
455
|
+
offset_omitted = offset - 1
|
456
|
+
end
|
457
|
+
url = commit_file_line_number_url(file_path, direction, offset_omitted)
|
435
458
|
if url
|
436
459
|
content = tag("a", {"href" => url}, content)
|
437
460
|
end
|
@@ -559,5 +582,37 @@ EOT
|
|
559
582
|
},
|
560
583
|
content)
|
561
584
|
end
|
585
|
+
|
586
|
+
def commit_file_url(file)
|
587
|
+
case @mailer.repository_browser
|
588
|
+
when "github"
|
589
|
+
base_url = commit_url
|
590
|
+
return nil if base_url.nil?
|
591
|
+
file_md5 = Digest::MD5.hexdigest(file)
|
592
|
+
"#{base_url}#diff-#{file_md5}"
|
593
|
+
when "github-wiki"
|
594
|
+
commit_file_url_github_wiki(file)
|
595
|
+
else
|
596
|
+
nil
|
597
|
+
end
|
598
|
+
end
|
599
|
+
|
600
|
+
def commit_file_line_number_url(file, direction, line_number)
|
601
|
+
base_url = commit_url
|
602
|
+
return nil if base_url.nil?
|
603
|
+
|
604
|
+
case @mailer.repository_browser
|
605
|
+
when "github"
|
606
|
+
file_md5 = Digest::MD5.hexdigest(file)
|
607
|
+
url = "#{base_url}#diff-#{file_md5}"
|
608
|
+
if line_number
|
609
|
+
url << ((direction == :from) ? "L" : "R")
|
610
|
+
url << line_number.to_s
|
611
|
+
end
|
612
|
+
url
|
613
|
+
else
|
614
|
+
nil
|
615
|
+
end
|
616
|
+
end
|
562
617
|
end
|
563
618
|
end
|
@@ -49,21 +49,6 @@ class GitCommitMailer
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
def commit_file_url(file)
|
53
|
-
case @mailer.repository_browser
|
54
|
-
when "github"
|
55
|
-
base_url = commit_url
|
56
|
-
return nil if base_url.nil?
|
57
|
-
index = @info.file_index(file)
|
58
|
-
return nil if index.nil?
|
59
|
-
"#{base_url}#diff-#{index}"
|
60
|
-
when "github-wiki"
|
61
|
-
commit_file_url_github_wiki(file)
|
62
|
-
else
|
63
|
-
nil
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
52
|
def commit_file_url_github_wiki(file)
|
68
53
|
return nil if file.nil?
|
69
54
|
|
@@ -76,22 +61,5 @@ class GitCommitMailer
|
|
76
61
|
revision = @info.revision
|
77
62
|
"#{base_url}/#{user}/#{repository}/wiki/#{page_name_in_url}/#{revision}"
|
78
63
|
end
|
79
|
-
|
80
|
-
def commit_file_line_number_url(file, direction, line_number)
|
81
|
-
base_url = commit_url
|
82
|
-
return nil if base_url.nil?
|
83
|
-
|
84
|
-
case @mailer.repository_browser
|
85
|
-
when "github"
|
86
|
-
index = @info.file_index(file)
|
87
|
-
return nil if index.nil?
|
88
|
-
url = "#{base_url}#L#{index}"
|
89
|
-
url << ((direction == :from) ? "L" : "R")
|
90
|
-
url << line_number.to_s
|
91
|
-
url
|
92
|
-
else
|
93
|
-
nil
|
94
|
-
end
|
95
|
-
end
|
96
64
|
end
|
97
65
|
end
|
data/lib/git-commit-mailer.rb
CHANGED
@@ -1039,7 +1039,7 @@ EOF
|
|
1039
1039
|
merge_message = "Merged #{merge_commit.short_revision}: #{merge_commit.subject}"
|
1040
1040
|
if not is_traversing_first_parent and not commit_info.merge_status.index(merge_message)
|
1041
1041
|
commit_info.merge_status << merge_message
|
1042
|
-
commit_info.
|
1042
|
+
commit_info.merge_commits << merge_commit
|
1043
1043
|
end
|
1044
1044
|
|
1045
1045
|
if commit_info.merge?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-commit-mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Onodera
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -81,9 +81,12 @@ files:
|
|
81
81
|
- ".gitignore"
|
82
82
|
- ".travis.yml"
|
83
83
|
- Gemfile
|
84
|
+
- LICENSE
|
84
85
|
- README.md
|
85
86
|
- Rakefile
|
86
87
|
- bin/git-commit-mailer
|
88
|
+
- doc/text/GPL-3.txt
|
89
|
+
- doc/text/news.md
|
87
90
|
- git-commit-mailer.gemspec
|
88
91
|
- lib/git-commit-mailer.rb
|
89
92
|
- lib/git-commit-mailer/commit-info.rb
|
@@ -94,7 +97,6 @@ files:
|
|
94
97
|
- lib/git-commit-mailer/push-info.rb
|
95
98
|
- lib/git-commit-mailer/text-mail-body-formatter.rb
|
96
99
|
- lib/git-commit-mailer/version.rb
|
97
|
-
- license/GPL-3.txt
|
98
100
|
homepage: https://github.com/clear-code/git-commit-mailer
|
99
101
|
licenses:
|
100
102
|
- GPL-3.0+
|
@@ -115,8 +117,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
117
|
version: '0'
|
116
118
|
requirements: []
|
117
119
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.2.2
|
119
121
|
signing_key:
|
120
122
|
specification_version: 4
|
121
123
|
summary: A utility to send commit mails for commits pushed to git repositories.
|
122
124
|
test_files: []
|
125
|
+
has_rdoc:
|