Permalink
Browse files

Ensure that a custom committer, if given, makes it into the git commit.

  • Loading branch information...
nreckart committed Dec 5, 2011
1 parent e8f0e27 commit 535cc325e9d257c9376e079c52f3fefa564c937d
Showing with 9 additions and 2 deletions.
  1. +2 −1 lib/gaga.rb
  2. +7 −1 test/gaga_test.rb
View
@@ -147,14 +147,15 @@ def head
# Commits the the value into the git repository with the given commit message
def save(options)
author = options[:author] ? Grit::Actor.new(options[:author][:name], options[:author][:email]) : nil
+ committer = options[:committer] ? Grit::Actor.new(options[:committer][:name], options[:committer][:email]) : nil
index = git.index
if head
commit = head.commit
index.current_tree = commit.tree
end
yield index
- index.commit(options[:message], :parents => Array(commit), :author => author, :head => branch) if index.tree.any?
+ index.commit(options[:message], :parents => Array(commit), :author => author, :committer => committer, :head => branch) if index.tree.any?
end
# Converts the value to yaml format
View
@@ -34,14 +34,20 @@
end
it "writes String values to keys with global custom log data" do
- store = Gaga.new(:repo => tmp_dir, :branch => :lady, :author => {:name => 'Test', :email => 'test@example.com'})
+ store = Gaga.new(
+ :repo => tmp_dir,
+ :branch => :lady,
+ :author => {:name => 'Test', :email => 'test@example.com'},
+ :committer => {:name => 'Test2', :email => 'test2@example.com'}
+ )
store.set(key, "value", {:message => "Custom message"})
store[key].must_equal "value"
entry = store.log(key).first
entry['message'].must_equal "Custom message"
entry['author'].must_equal({'name' => 'Test', 'email' => 'test@example.com'})
+ entry['committer'].must_equal({'name' => 'Test2', 'email' => 'test2@example.com'})
end
it "does not create empty commit" do

1 comment on commit 535cc32

jamew commented on 535cc32 Aug 10, 2015

How do u get on to play

Please sign in to comment.