diff options
author | scott Chacon <schacon@agadorsparticus.(none)> | 2007-11-19 07:14:20 -0800 |
---|---|---|
committer | scott Chacon <schacon@agadorsparticus.(none)> | 2007-11-19 07:14:20 -0800 |
commit | 303ffc868266400a518602d2e9e9285361029cb2 (patch) | |
tree | 62ef43fd48df23b55e01733a88fc13f616cf615f /lib/git/object.rb | |
parent | f64d5462fa5323fc81387f79eebe9e1ae9eb0b08 (diff) | |
download | third_party-ruby-git-303ffc868266400a518602d2e9e9285361029cb2.tar.gz third_party-ruby-git-303ffc868266400a518602d2e9e9285361029cb2.tar.xz third_party-ruby-git-303ffc868266400a518602d2e9e9285361029cb2.zip |
changed logging to be far more efficient if you're accessing all the commit objects
Diffstat (limited to 'lib/git/object.rb')
-rw-r--r-- | lib/git/object.rb | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/git/object.rb b/lib/git/object.rb index aeeae89..058053c 100644 --- a/lib/git/object.rb +++ b/lib/git/object.rb @@ -151,6 +151,13 @@ module Git @committer = nil @message = nil + def initialize(base, sha, init = nil) + super(base, sha) + if init + set_commit(init) + end + end + def message check_commit @message @@ -199,6 +206,14 @@ module Git def diff_parent diff(parent) end + + def set_commit(data) + @committer = Git::Author.new(data['committer']) + @author = Git::Author.new(data['author']) + @tree = Tree.new(@base, data['tree']) + @parents = data['parent'].map{ |sha| Commit.new(@base, sha) } + @message = data['message'].chomp + end private @@ -210,11 +225,7 @@ module Git def check_commit if !@tree data = @base.lib.commit_data(@objectish) - @committer = Git::Author.new(data['committer']) - @author = Git::Author.new(data['author']) - @tree = Tree.new(@base, data['tree']) - @parents = data['parent'].map{ |sha| Commit.new(@base, sha) } - @message = data['message'].chomp + set_commit(data) end end |