git-commit-notifier 0.11.6 → 0.11.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -1
- data/README.md +70 -4
- data/VERSION +1 -1
- data/config/git-notifier-config.example.yml +4 -1
- data/git-commit-notifier.gemspec +1 -1
- data/lib/git_commit_notifier/diff_to_html.rb +42 -17
- data/lib/git_commit_notifier/emailer.rb +1 -1
- data/lib/git_commit_notifier/git.rb +35 -3
- data/spec/lib/git_commit_notifier/commit_hook_spec.rb +1 -1
- data/spec/lib/git_commit_notifier/diff_to_html_spec.rb +2 -2
- data/spec/lib/git_commit_notifier/git_spec.rb +13 -5
- metadata +5 -5
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Git Commit Notifier
|
2
2
|
|
3
|
-
[![Build Status](
|
3
|
+
[![Build Status](https://travis-ci.org/git-commit-notifier/git-commit-notifier.png)](https://travis-ci.org/git-commit-notifier/git-commit-notifier)
|
4
4
|
|
5
5
|
__by Bodo Tasche (bodo 'at' wannawork 'dot' de), Akzhan Abdulin (akzhan 'dot' abdulin 'at' gmail 'dot' com), Csoma Zoltan (info 'at' railsprogrammer 'dot' net)__
|
6
6
|
|
@@ -52,7 +52,7 @@ git-commit-notifier path_to_config.yml
|
|
52
52
|
|
53
53
|
(Don't forget to make that file executable.)
|
54
54
|
|
55
|
-
An example for the config file can be found in [config/git-notifier-config.example.yml](http://github.com/
|
55
|
+
An example for the config file can be found in [config/git-notifier-config.example.yml](http://github.com/git-commit-notifier/git-commit-notifier/blob/master/config/git-notifier-config.example.yml).
|
56
56
|
|
57
57
|
If you want to send mails on each commit instead on each push, you should add a file called "post-commit" with this content:
|
58
58
|
|
@@ -74,7 +74,54 @@ Git-commit-notifier supports easy integration with Redmine, Bugzilla and MediaWi
|
|
74
74
|
Git-commit-notifier can send a webhook just after sending a mail, This webook will be sent in a POST request to a server specified in the configuration (webhook / url), under JSON format following the same syntax as Github webhooks.
|
75
75
|
|
76
76
|
* [Cogbot](https://github.com/mose/cogbot) is the irc bot for which that feature was originaly designed for. Only a subset of the Github json file was required for that one so maybe it won't work on all Github webhook recievers.
|
77
|
-
* [Github webhooks](https://help.github.com/articles/post-receive-hooks) describes the json format expected and some hints on how to design a webhook reciever.
|
77
|
+
* [Github webhooks](https://help.github.com/articles/post-receive-hooks) describes the json format expected and some hints on how to design a webhook reciever. Be sure to extract the 'ref' from the json. An example Sinatra server to use git-commit-notifier might look like:
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
require 'rubygems'
|
81
|
+
require 'json'
|
82
|
+
require 'sinatra'
|
83
|
+
|
84
|
+
post '/' do
|
85
|
+
if params[:payload]
|
86
|
+
push = JSON.parse(params[:payload])
|
87
|
+
|
88
|
+
repo = push['repository']['name']
|
89
|
+
before_id = push['before']
|
90
|
+
after_id = push['after']
|
91
|
+
ref = push['ref']
|
92
|
+
|
93
|
+
system("/usr/local/bin/change-notify.sh #{repo} #{before_id} #{after_id} #{ref}")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
```
|
97
|
+
|
98
|
+
change-notify.sh might look like:
|
99
|
+
|
100
|
+
```sh
|
101
|
+
#!/bin/sh
|
102
|
+
|
103
|
+
set -e
|
104
|
+
|
105
|
+
EXPECTED_ARGS=4
|
106
|
+
E_BADARGS=65
|
107
|
+
|
108
|
+
if [ $# -ne $EXPECTED_ARGS ]
|
109
|
+
then
|
110
|
+
echo "Usage: `basename $0` {repo} {before commit ID} {after commit ID} {ref}"
|
111
|
+
exit $E_BADARGS
|
112
|
+
fi
|
113
|
+
|
114
|
+
REPO=$1
|
115
|
+
BEFORE=$2
|
116
|
+
AFTER=$3
|
117
|
+
REF=$4
|
118
|
+
CONFIG=myconfig.yml
|
119
|
+
|
120
|
+
# Assume repository exists in directory and user has pull access
|
121
|
+
cd /repository/$REPO
|
122
|
+
git pull
|
123
|
+
echo $BEFORE $AFTER $REF | /usr/local/bin/git-commit-notifier $CONFIG
|
124
|
+
```
|
78
125
|
|
79
126
|
## Integration of links to other websites
|
80
127
|
|
@@ -104,9 +151,28 @@ you should receive new message about commit when it's merged in other branch.
|
|
104
151
|
Yet another option, skip\_commits\_older\_than (in days), should be used to not inform about
|
105
152
|
old commits in processes of forking, branching etc.
|
106
153
|
|
154
|
+
## Note on development
|
155
|
+
|
156
|
+
It's easy to fork and clone our repository.
|
157
|
+
|
158
|
+
Next step is installation of required dependencies:
|
159
|
+
|
160
|
+
```bash
|
161
|
+
cd $GCN_REPO
|
162
|
+
bundle install
|
163
|
+
rake # Run specs
|
164
|
+
```
|
165
|
+
|
166
|
+
Now you can create test configuration file (example provided in `config` directory) and test your code over any test repository in this manner:
|
167
|
+
|
168
|
+
```bash
|
169
|
+
cd $TEST_REPO
|
170
|
+
echo "HEAD^1 HEAD refs/heads/master" | $GCN_REPO/local-run.rb $PATH_TO_YAML_CONFIG
|
171
|
+
```
|
172
|
+
|
107
173
|
## Note on Patches/Pull Requests
|
108
174
|
|
109
|
-
* Fork [the project](https://github.com/
|
175
|
+
* Fork [the project](https://github.com/git-commit-notifier/git-commit-notifier).
|
110
176
|
* Make your feature addition or bug fix.
|
111
177
|
* Add tests for it. This is important so I don't break it in a
|
112
178
|
future version unintentionally.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.11.
|
1
|
+
0.11.9
|
@@ -180,7 +180,10 @@ unique_commits_per_branch: false
|
|
180
180
|
show_master_branch_name: false
|
181
181
|
|
182
182
|
# ignore whitespace?
|
183
|
-
|
183
|
+
# all: ignore all whitespace (same as true)
|
184
|
+
# change: ignore changes in amount of whitespace
|
185
|
+
# none: do not ignore any whitespace (same as false)
|
186
|
+
ignore_whitespace: all
|
184
187
|
|
185
188
|
# adding parameters to send webhooks
|
186
189
|
# webooks:
|
data/git-commit-notifier.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.add_development_dependency(%q<rspec-core>, [">= 0"])
|
37
37
|
s.add_development_dependency(%q<rspec-expectations>, [">= 0"])
|
38
38
|
s.add_development_dependency(%q<rr>, ["~> 1.0"])
|
39
|
-
s.add_development_dependency(%q<faker>, ["~> 1.
|
39
|
+
s.add_development_dependency(%q<faker>, ["~> 1.1.2"])
|
40
40
|
s.add_development_dependency(%q<yard>, ["~> 0.8.1"])
|
41
41
|
s.add_development_dependency(%q<redcarpet>, ["~> 2.1"])
|
42
42
|
end
|
@@ -11,6 +11,8 @@ module GitCommitNotifier
|
|
11
11
|
class DiffToHtml
|
12
12
|
include EscapeHelper
|
13
13
|
|
14
|
+
|
15
|
+
|
14
16
|
# Integration map for commit message keywords to third-party links.
|
15
17
|
INTEGRATION_MAP = {
|
16
18
|
:mediawiki => { :search_for => /\[\[([^\[\]]+)\]\]/, :replace_with => '#{url}/\1' },
|
@@ -49,6 +51,10 @@ module GitCommitNotifier
|
|
49
51
|
@file_removed = false
|
50
52
|
@file_changes = []
|
51
53
|
@binary = false
|
54
|
+
unless String.method_defined?(:encode!)
|
55
|
+
require 'iconv'
|
56
|
+
@ic = Iconv.new('UTF-8', 'UTF-8//IGNORE')
|
57
|
+
end
|
52
58
|
end
|
53
59
|
|
54
60
|
def range_info(range)
|
@@ -90,9 +96,11 @@ module GitCommitNotifier
|
|
90
96
|
end
|
91
97
|
|
92
98
|
# Gets ignore_whitespace setting from {#config}.
|
93
|
-
# @return [
|
94
|
-
def
|
95
|
-
|
99
|
+
# @return [String] How whitespaces should be treated in diffs (none, all, change)
|
100
|
+
def ignore_whitespace
|
101
|
+
return 'all' if config['ignore_whitespace'].nil?
|
102
|
+
return 'none' if !config['ignore_whitespace']
|
103
|
+
(['all', 'change', 'none'].include?(config['ignore_whitespace']) ? config['ignore_whitespace'] : 'all')
|
96
104
|
end
|
97
105
|
|
98
106
|
# Adds separator between diff blocks to @diff_result.
|
@@ -184,17 +192,24 @@ module GitCommitNotifier
|
|
184
192
|
|
185
193
|
file_name = @current_file_name
|
186
194
|
|
195
|
+
text = "#{op} #{binary}file #{file_name}"
|
196
|
+
|
187
197
|
# TODO: these filenames, etc, should likely be properly html escaped
|
198
|
+
file_link = file_name
|
188
199
|
if config['link_files']
|
189
|
-
|
200
|
+
file_link = if config["link_files"] == "gitweb" && config["gitweb"]
|
190
201
|
"<a href='#{config['gitweb']['path']}?p=#{config['gitweb']['project'] || "#{Git.repo_name}.git"};f=#{file_name};h=#{@current_sha};hb=#{@current_commit}'>#{file_name}</a>"
|
191
202
|
elsif config["link_files"] == "gitorious" && config["gitorious"]
|
192
203
|
"<a href='#{config['gitorious']['path']}/#{config['gitorious']['project']}/#{config['gitorious']['repository']}/blobs/#{branch_name}/#{file_name}'>#{file_name}</a>"
|
204
|
+
elsif config["link_files"] == "trac" && config["trac"]
|
205
|
+
"<a href='#{config['trac']['path']}/#{@current_commit}/#{file_name}'>#{file_name}</a>"
|
193
206
|
elsif config["link_files"] == "cgit" && config["cgit"]
|
194
|
-
"<a href='#{config['cgit']['path']}/#{config['cgit']['project']}/tree/#{file_name}'>#{file_name}</a>"
|
207
|
+
"<a href='#{config['cgit']['path']}/#{config['cgit']['project']}/tree/#{file_name}?h=#{branch_name}'>#{file_name}</a>"
|
195
208
|
elsif config["link_files"] == "gitlabhq" && config["gitlabhq"]
|
196
209
|
if config["gitlabhq"]["version"] && config["gitlabhq"]["version"] < 1.2
|
197
210
|
"<a href='#{config['gitlabhq']['path']}/#{Git.repo_name.gsub(".", "_")}/tree/#{@current_commit}/#{file_name}'>#{file_name}</a>"
|
211
|
+
elsif config["gitlabhq"]["version"] && config["gitlabhq"]["version"] >= 4.0
|
212
|
+
"<a href='#{config['gitlabhq']['path']}/#{Git.repo_name_with_parent.gsub(".", "_")}/commit/#{@current_commit}'>#{file_name}</a>"
|
198
213
|
else
|
199
214
|
"<a href='#{config['gitlabhq']['path']}/#{Git.repo_name.gsub(".", "_")}/#{@current_commit}/tree/#{file_name}'>#{file_name}</a>"
|
200
215
|
end
|
@@ -205,13 +220,14 @@ module GitCommitNotifier
|
|
205
220
|
end
|
206
221
|
end
|
207
222
|
|
208
|
-
header = "#{op} #{binary}file #{file_name}"
|
209
|
-
|
210
223
|
if show_summary?
|
211
|
-
@file_changes <<
|
224
|
+
@file_changes << {
|
225
|
+
:file_name => file_name,
|
226
|
+
:text => text,
|
227
|
+
}
|
212
228
|
end
|
213
229
|
|
214
|
-
"<
|
230
|
+
"<a name=\"#{file_name}\"></a><h2>#{op} #{binary}file #{file_link}</h2>\n"
|
215
231
|
end
|
216
232
|
|
217
233
|
# Determines are two lines are sequentially placed in diff (no skipped lines between).
|
@@ -504,16 +520,25 @@ module GitCommitNotifier
|
|
504
520
|
# @see COMMIT_LINK_MAP
|
505
521
|
def markup_commit_for_html(commit)
|
506
522
|
mode = (config["link_files"] || "default").to_sym
|
507
|
-
mode = :default unless config.has_key?(mode)
|
523
|
+
mode = :default unless config.has_key?(mode.to_s)
|
508
524
|
mode = :default unless COMMIT_LINK_MAP.has_key?(mode)
|
509
525
|
COMMIT_LINK_MAP[mode].call(config, commit)
|
510
526
|
end
|
511
527
|
|
512
528
|
def diff_for_commit(commit)
|
513
529
|
@current_commit = commit
|
514
|
-
raw_diff = truncate_long_lines(Git.show(commit, :
|
530
|
+
raw_diff = truncate_long_lines(Git.show(commit, :ignore_whitespace => ignore_whitespace))
|
515
531
|
raise "git show output is empty" if raw_diff.empty?
|
516
532
|
|
533
|
+
if raw_diff.respond_to?(:encode!)
|
534
|
+
unless raw_diff.valid_encoding?
|
535
|
+
raw_diff.encode!("UTF-16", "UTF-8", :invalid => :replace, :undef => :replace)
|
536
|
+
raw_diff.encode!("UTF-8", "UTF-16")
|
537
|
+
end
|
538
|
+
else
|
539
|
+
raw_diff = @ic.iconv(raw_diff)
|
540
|
+
end
|
541
|
+
|
517
542
|
commit_info = extract_commit_info_from_git_show_output(raw_diff)
|
518
543
|
return nil if old_commit?(commit_info)
|
519
544
|
changed_files = ""
|
@@ -551,12 +576,12 @@ module GitCommitNotifier
|
|
551
576
|
html_diff = diff_for_revision(extract_diff_from_git_show_output(raw_diff))
|
552
577
|
message_array = message_array_as_html(changed_files.split("\n"))
|
553
578
|
|
554
|
-
if show_summary?
|
579
|
+
if show_summary?
|
555
580
|
title += "<ul>"
|
556
581
|
|
557
|
-
@file_changes.each do |
|
558
|
-
title += "<li><a href=\"\##{file_name}\">#{
|
559
|
-
text += "#{
|
582
|
+
@file_changes.each do |change|
|
583
|
+
title += "<li><a href=\"\##{change[:file_name]}\">#{change[:text]}</a></li>"
|
584
|
+
text += "#{change[:text]}\n"
|
560
585
|
end
|
561
586
|
|
562
587
|
title += "</ul>"
|
@@ -651,10 +676,10 @@ module GitCommitNotifier
|
|
651
676
|
html += "<dt>Message</dt><dd class='#{multi_line_message ? "multi-line" : ""}'>#{message_array_as_html(message_array)}</dd>\n"
|
652
677
|
html += "</dl>"
|
653
678
|
|
654
|
-
text = "Tag
|
679
|
+
text = "Tag: #{tag} (#{change_type == :create ? "added" : "updated"})\n"
|
655
680
|
text += "Type: annotated\n"
|
656
681
|
text += "Commit: #{tag_info[:tagobject]}\n"
|
657
|
-
text += "Tagger: tag_info[:taggername] tag_info[:taggeremail]\n"
|
682
|
+
text += "Tagger: #{tag_info[:taggername]} #{tag_info[:taggeremail]}\n"
|
658
683
|
text += "Message: #{tag_info[:contents]}\n"
|
659
684
|
|
660
685
|
commit_info[:message] = message
|
@@ -9,7 +9,7 @@ class GitCommitNotifier::Emailer
|
|
9
9
|
# Default ERB template file path
|
10
10
|
TEMPLATE = File.join(File.dirname(__FILE__), *'../../template/email.html.erb'.split('/')).freeze
|
11
11
|
# Instance variable names
|
12
|
-
PARAMETERS = %w[project_path recipient from_address from_alias date subject text_message html_message repo_name ref_name old_rev new_rev].freeze
|
12
|
+
PARAMETERS = %w[project_path recipient from_address from_alias reply_to_address date subject text_message html_message repo_name ref_name old_rev new_rev].freeze
|
13
13
|
|
14
14
|
# Gets config.
|
15
15
|
# @return [Hash] Configuration
|
@@ -30,11 +30,12 @@ class GitCommitNotifier::Git
|
|
30
30
|
# @see from_shell
|
31
31
|
# @param [String] rev Revision
|
32
32
|
# @param [Hash] opts Options
|
33
|
-
# @option opts [
|
33
|
+
# @option opts [String] :ignore_whitespace How whitespaces should be treated
|
34
34
|
def show(rev, opts = {})
|
35
35
|
gitopt = " --date=rfc2822"
|
36
36
|
gitopt += " --pretty=fuller"
|
37
|
-
gitopt += " -w" if opts[:
|
37
|
+
gitopt += " -w" if opts[:ignore_whitespace] == 'all'
|
38
|
+
gitopt += " -b" if opts[:ignore_whitespace] == 'change'
|
38
39
|
from_shell("git show #{rev.strip}#{gitopt}")
|
39
40
|
end
|
40
41
|
|
@@ -97,6 +98,10 @@ class GitCommitNotifier::Git
|
|
97
98
|
from_shell("git rev-parse --git-dir").strip
|
98
99
|
end
|
99
100
|
|
101
|
+
def toplevel_dir
|
102
|
+
from_shell("git rev-parse --show-toplevel").strip
|
103
|
+
end
|
104
|
+
|
100
105
|
def rev_parse(param)
|
101
106
|
from_shell("git rev-parse '#{param}'").strip
|
102
107
|
end
|
@@ -167,7 +172,34 @@ class GitCommitNotifier::Git
|
|
167
172
|
''
|
168
173
|
end
|
169
174
|
return git_prefix unless git_prefix.empty?
|
170
|
-
|
175
|
+
git_path = toplevel_dir
|
176
|
+
# In a bare repository, toplevel directory is empty. Revert to git_dir instead.
|
177
|
+
if git_path.empty?
|
178
|
+
git_path = git_dir
|
179
|
+
end
|
180
|
+
File.expand_path(git_path).split("/").last.sub(/\.git$/, '')
|
181
|
+
end
|
182
|
+
|
183
|
+
# Gets repository name.
|
184
|
+
# @note Tries to gets human readable repository name through `git config hooks.emailprefix` call.
|
185
|
+
# If it's not specified then returns directory name with parent directory name (except '.git'
|
186
|
+
# suffix if exists).
|
187
|
+
# @return [String] Human readable repository name.
|
188
|
+
def repo_name_with_parent
|
189
|
+
git_prefix = begin
|
190
|
+
from_shell("git config hooks.emailprefix").strip
|
191
|
+
rescue ArgumentError
|
192
|
+
''
|
193
|
+
end
|
194
|
+
return git_prefix unless git_prefix.empty?
|
195
|
+
git_path = toplevel_dir
|
196
|
+
# In a bare repository, toplevel directory is empty. Revert to git_dir instead.
|
197
|
+
if git_path.empty?
|
198
|
+
git_path = git_dir
|
199
|
+
end
|
200
|
+
name_with_parent = File.expand_path(git_path).scan(/[a-zA-z0-9]+\/[a-zA-Z0-9]+.git$/).first;
|
201
|
+
return name_with_parent.sub(/\.git$/, '') unless name_with_parent.empty?
|
202
|
+
File.expand_path(git_path).split("/").last.sub(/\.git$/, '')
|
171
203
|
end
|
172
204
|
|
173
205
|
# Gets mailing list address.
|
@@ -79,7 +79,7 @@ describe GitCommitNotifier::CommitHook do
|
|
79
79
|
mock(GitCommitNotifier::Git).repo_name { 'testproject' }
|
80
80
|
mock(GitCommitNotifier::Git).changed_files('7e4f6b4', '4f13525') { [] }
|
81
81
|
REVISIONS.each do |rev|
|
82
|
-
mock(GitCommitNotifier::Git).show(rev, :
|
82
|
+
mock(GitCommitNotifier::Git).show(rev, :ignore_whitespace => 'all') { IO.read(FIXTURES_PATH + "git_show_#{rev}") }
|
83
83
|
dont_allow(GitCommitNotifier::Git).describe(rev) { IO.read(FIXTURES_PATH + "git_describe_#{rev}") }
|
84
84
|
end
|
85
85
|
end
|
@@ -106,7 +106,7 @@ describe GitCommitNotifier::DiffToHtml do
|
|
106
106
|
mock(GitCommitNotifier::Git).rev_type(REVISIONS.last) { "commit" }
|
107
107
|
mock(GitCommitNotifier::Git).new_commits(anything, anything, anything, anything) { REVISIONS.reverse }
|
108
108
|
REVISIONS.each do |rev|
|
109
|
-
mock(GitCommitNotifier::Git).show(rev, :
|
109
|
+
mock(GitCommitNotifier::Git).show(rev, :ignore_whitespace => 'all') { IO.read(FIXTURES_PATH + 'git_show_' + rev) }
|
110
110
|
dont_allow(GitCommitNotifier::Git).describe(rev) { IO.read(FIXTURES_PATH + 'git_describe_' + rev) }
|
111
111
|
end
|
112
112
|
|
@@ -161,7 +161,7 @@ describe GitCommitNotifier::DiffToHtml do
|
|
161
161
|
mock(GitCommitNotifier::Git).rev_type(last_rev) { "commit" }
|
162
162
|
mock(GitCommitNotifier::Git).new_commits(anything, anything, anything, anything) { [ 'ff037a73fc1094455e7bbf506171a3f3cf873ae6' ] }
|
163
163
|
%w[ ff037a73fc1094455e7bbf506171a3f3cf873ae6 ].each do |rev|
|
164
|
-
mock(GitCommitNotifier::Git).show(rev, :
|
164
|
+
mock(GitCommitNotifier::Git).show(rev, :ignore_whitespace => 'all') { IO.read(FIXTURES_PATH + 'git_show_' + rev) }
|
165
165
|
dont_allow(GitCommitNotifier::Git).describe(rev) { IO.read(FIXTURES_PATH + 'git_describe_' + rev) }
|
166
166
|
end
|
167
167
|
diff = GitCommitNotifier::DiffToHtml.new
|
@@ -17,18 +17,18 @@ describe GitCommitNotifier::Git do
|
|
17
17
|
it "should get data from shell: git show without whitespaces" do
|
18
18
|
expected = 'some data from git show'
|
19
19
|
mock(GitCommitNotifier::Git).from_shell("git show #{SAMPLE_REV} --date=rfc2822 --pretty=fuller -w") { expected }
|
20
|
-
GitCommitNotifier::Git.show(SAMPLE_REV, :
|
20
|
+
GitCommitNotifier::Git.show(SAMPLE_REV, :ignore_whitespace => 'all').should == expected
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should get data from shell: git show with whitespaces" do
|
24
24
|
expected = 'some data from git show'
|
25
25
|
mock(GitCommitNotifier::Git).from_shell("git show #{SAMPLE_REV} --date=rfc2822 --pretty=fuller") { expected }
|
26
|
-
GitCommitNotifier::Git.show(SAMPLE_REV, :
|
26
|
+
GitCommitNotifier::Git.show(SAMPLE_REV, :ignore_whitespace => 'none').should == expected
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should strip given revision" do
|
30
30
|
mock(GitCommitNotifier::Git).from_shell("git show #{SAMPLE_REV} --date=rfc2822 --pretty=fuller -w")
|
31
|
-
GitCommitNotifier::Git.show("#{SAMPLE_REV}\n", :
|
31
|
+
GitCommitNotifier::Git.show("#{SAMPLE_REV}\n", :ignore_whitespace => 'all')
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -70,15 +70,23 @@ describe GitCommitNotifier::Git do
|
|
70
70
|
|
71
71
|
it "should return folder name if no emailprefix and directory not ended with .git" do
|
72
72
|
mock(GitCommitNotifier::Git).from_shell("git config hooks.emailprefix") { " " }
|
73
|
-
|
73
|
+
stub(GitCommitNotifier::Git).toplevel_dir { "/home/someuser/repositories/myrepo" }
|
74
74
|
GitCommitNotifier::Git.repo_name.should == "myrepo"
|
75
75
|
end
|
76
76
|
|
77
77
|
it "should return folder name without extension if no emailprefix and directory ended with .git" do
|
78
78
|
mock(GitCommitNotifier::Git).from_shell("git config hooks.emailprefix") { " " }
|
79
|
-
|
79
|
+
stub(GitCommitNotifier::Git).toplevel_dir { "/home/someuser/repositories/myrepo.git" }
|
80
80
|
GitCommitNotifier::Git.repo_name.should == "myrepo"
|
81
81
|
end
|
82
|
+
|
83
|
+
it "should return folder name if no emailprefix and toplevel dir and directory not ended with .git" do
|
84
|
+
mock(GitCommitNotifier::Git).from_shell("git config hooks.emailprefix") { " " }
|
85
|
+
stub(GitCommitNotifier::Git).toplevel_dir { "" }
|
86
|
+
stub(GitCommitNotifier::Git).git_dir { "/home/someuser/repositories/myrepo.git" }
|
87
|
+
GitCommitNotifier::Git.repo_name.should == "myrepo"
|
88
|
+
end
|
89
|
+
|
82
90
|
end
|
83
91
|
|
84
92
|
describe :log do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-commit-notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-02-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: diff-lcs
|
@@ -219,7 +219,7 @@ dependencies:
|
|
219
219
|
requirements:
|
220
220
|
- - ~>
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version:
|
222
|
+
version: 1.1.2
|
223
223
|
type: :development
|
224
224
|
prerelease: false
|
225
225
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -227,7 +227,7 @@ dependencies:
|
|
227
227
|
requirements:
|
228
228
|
- - ~>
|
229
229
|
- !ruby/object:Gem::Version
|
230
|
-
version:
|
230
|
+
version: 1.1.2
|
231
231
|
- !ruby/object:Gem::Dependency
|
232
232
|
name: yard
|
233
233
|
requirement: !ruby/object:Gem::Requirement
|
@@ -338,7 +338,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
338
338
|
version: '0'
|
339
339
|
segments:
|
340
340
|
- 0
|
341
|
-
hash:
|
341
|
+
hash: 1338348343432938380
|
342
342
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
343
343
|
none: false
|
344
344
|
requirements:
|