lib/gitrb/commit.rb in gitrb-0.0.8 vs lib/gitrb/commit.rb in gitrb-0.0.9
- old
+ new
@@ -1,40 +1,40 @@
module Gitrb
- class Commit < Gitrb::Object
- attr_accessor :tree, :parent, :author, :committer, :message
+ class Commit < GitObject
+ attr_accessor :tree, :parents, :author, :committer, :message
def initialize(options = {})
super(options)
- @parent = [options[:parent]].flatten.compact
+ @parents = [options[:parents]].flatten.compact
@tree = options[:tree]
@author = options[:author]
@committer = options[:committer]
@message = options[:message]
parse(options[:data]) if options[:data]
end
def type
- 'commit'
+ :commit
end
def date
(committer && committer.date) || (author && author.date)
end
def ==(other)
- Commit === other and id == other.id
+ Commit === other && id == other.id
end
def save
repository.put(self)
id
end
def dump
[ "tree #{tree.id}",
- @parent.map { |p| "parent #{p.id}" },
+ @parents.map { |p| "parent #{p.id}" },
"author #{author.dump}",
"committer #{committer.dump}",
'',
message ].flatten.join("\n")
end
@@ -52,10 +52,10 @@
headers.split("\n").each do |header|
key, value = header.split(' ', 2)
case key
when 'parent'
- @parent << Reference.new(:repository => repository, :id => repository.set_encoding(value))
+ @parents << Reference.new(:repository => repository, :id => repository.set_encoding(value))
when 'author'
@author = User.parse(repository.set_encoding(value))
when 'committer'
@committer = User.parse(repository.set_encoding(value))
when 'tree'