Skip to content
Browse files

Stop creating empty commits when saving duplicate values.

  • Loading branch information...
1 parent 09e9ce1 commit 4222293c653c4846af97d554260f4e742ed1b7c1 @nreckart nreckart committed Dec 2, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/gaga.rb
View
6 lib/gaga.rb
@@ -20,8 +20,10 @@ def initialize(options = {})
#
# Returns nothing
def set(key, value, opts = {})
- save(setup_commit_options({:message => "set '#{key}'"}.merge(opts))) do |index|
- index.add(key_for(key), encode(value))
+ unless value == get(key)
+ save(setup_commit_options({:message => "set '#{key}'"}.merge(opts))) do |index|
+ index.add(key_for(key), encode(value))
+ end
end
end

0 comments on commit 4222293

Please sign in to comment.
Something went wrong with that request. Please try again.