Class: MultiGit::GitBackend::Commit
- Inherits:
-
Object
- Object
- Object
- MultiGit::GitBackend::Commit
show all
- Includes:
- Commit
- Defined in:
- lib/multi_git/git_backend/commit.rb
Instance Attribute Summary
Attributes included from Object
#oid, #repository
Instance Method Summary
collapse
#[], #type
#abstract
Methods included from Object
#bytesize, #content, #to_builder, #to_io
Instance Method Details
28
29
30
31
|
# File 'lib/multi_git/git_backend/commit.rb', line 28
def author
read!
@author
end
|
#commit_time ⇒ Object
38
39
40
41
|
# File 'lib/multi_git/git_backend/commit.rb', line 38
def commit_time
read!
@commit_time
end
|
#committer ⇒ Object
23
24
25
26
|
# File 'lib/multi_git/git_backend/commit.rb', line 23
def committer
read!
@committer
end
|
18
19
20
21
|
# File 'lib/multi_git/git_backend/commit.rb', line 18
def message
read!
@message
end
|
8
9
10
11
|
# File 'lib/multi_git/git_backend/commit.rb', line 8
def parents
read!
@parents ||= @parent_oids.map{|oid| repository.read(oid) }
end
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/multi_git/git_backend/commit.rb', line 43
def read!
return if @read
@read = true
@header, @message = content.split("\n\n")
@parent_oids = []
@header.each_line do |line|
type, content = line.split(' ',2)
case(type)
when 'tree' then @tree_oid = content.chomp
when 'parent' then @parent_oids << content.chomp
when 'author' then
@author, @time = parse_signature(content)
when 'committer' then
@committer, @commit_time = parse_signature(content)
else
raise "Commit line type: #{type}"
end
end
end
|
33
34
35
36
|
# File 'lib/multi_git/git_backend/commit.rb', line 33
def time
read!
@time
end
|
13
14
15
16
|
# File 'lib/multi_git/git_backend/commit.rb', line 13
def tree
read!
@tree ||= repository.read(@tree_oid)
end
|