git-duet 0.1.1 → 0.1.2
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.
- data/.rbenv-version +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +1 -1
- data/lib/git/duet/command_methods.rb +9 -15
- data/lib/git/duet/commit_command.rb +0 -4
- data/lib/git/duet/version.rb +1 -1
- data/spec/integration/end_to_end_spec.rb +20 -0
- metadata +2 -3
data/.rbenv-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.3-
|
1
|
+
1.9.3-p392
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -18,6 +18,11 @@ module Git::Duet::CommandMethods
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def author_env_vars_set?
|
22
|
+
`git config --get duet.env.git-author-name && git config --get duet.env.git-author-email`
|
23
|
+
$? == 0
|
24
|
+
end
|
25
|
+
|
21
26
|
def dump_env_vars
|
22
27
|
extract_env_vars_from_git_config.each do |k,v|
|
23
28
|
puts "#{k}='#{v}'"
|
@@ -38,21 +43,10 @@ module Git::Duet::CommandMethods
|
|
38
43
|
end
|
39
44
|
|
40
45
|
def exec_git_commit
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
@env_vars ||= Hash[env_var_pairs]
|
46
|
-
end
|
47
|
-
|
48
|
-
def env_var_pairs
|
49
|
-
%w(
|
50
|
-
GIT_AUTHOR_NAME
|
51
|
-
GIT_AUTHOR_EMAIL
|
52
|
-
GIT_COMMITTER_NAME
|
53
|
-
GIT_COMMITTER_EMAIL
|
54
|
-
).map do |env_var|
|
55
|
-
[env_var, env_var.downcase.gsub(/_/, '-')]
|
46
|
+
if author_env_vars_set?
|
47
|
+
exec 'git commit ' << signoff_arg << quoted_passthrough_args
|
48
|
+
else
|
49
|
+
raise Git::Duet::ScriptDieError.new(17)
|
56
50
|
end
|
57
51
|
end
|
58
52
|
|
data/lib/git/duet/version.rb
CHANGED
@@ -235,6 +235,26 @@ describe 'git-duet end to end', :integration => true do
|
|
235
235
|
`git log -1 --format='%cn <%ce>'`.chomp.should == 'Frances Bar <f.bar@hamster.info.local>'
|
236
236
|
end
|
237
237
|
|
238
|
+
context 'when no author has been set' do
|
239
|
+
before do
|
240
|
+
Dir.chdir(@repo_dir)
|
241
|
+
%w(git-author-email git-author-name).each do |config|
|
242
|
+
`git config --unset duet.env.#{config}`
|
243
|
+
end
|
244
|
+
make_an_edit
|
245
|
+
end
|
246
|
+
|
247
|
+
it 'should raise an error if committed without the -q option' do
|
248
|
+
`git duet-commit -q -m 'Testing commit with no author'`
|
249
|
+
$?.to_i.should_not == 0
|
250
|
+
end
|
251
|
+
|
252
|
+
it 'should fail to add a commit' do
|
253
|
+
expect{ `git duet-commit -q -m 'testing commit with no author'` }.
|
254
|
+
to_not change{ `git log -1 --format=%H`.chomp }
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
238
258
|
context 'with the pre-commit hook in place' do
|
239
259
|
before :each do
|
240
260
|
`git commit -m 'Committing before installing the hook'`
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-duet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2013-05-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: nyan-cat-formatter
|
@@ -169,4 +169,3 @@ test_files:
|
|
169
169
|
- spec/lib/git/duet/solo_command_spec.rb
|
170
170
|
- spec/spec_helper.rb
|
171
171
|
- spec/support/author_mapper_helper.rb
|
172
|
-
has_rdoc:
|