Class: Git::Object::Commit
Instance Attribute Summary
#mode, #objectish, #size, #type
Instance Method Summary
collapse
#archive, #blob?, #contents, #contents_array, #diff, #grep, #log, #sha, #tag?, #to_s, #tree?
Constructor Details
permalink
#initialize(base, sha, init = nil) ⇒ Commit
Returns a new instance of Commit.
[View source]
162
163
164
165
166
167
168
169
170
171
172
|
# File 'lib/git/object.rb', line 162
def initialize(base, sha, init = nil)
super(base, sha)
@tree = nil
@parents = nil
@author = nil
@committer = nil
@message = nil
if init
set_commit(init)
end
end
|
Instance Method Details
[View source]
199
200
201
202
|
# File 'lib/git/object.rb', line 199
def author
check_commit
@author
end
|
[View source]
204
205
206
|
# File 'lib/git/object.rb', line 204
def author_date
author.date
end
|
permalink
#commit? ⇒ Boolean
[View source]
232
233
234
|
# File 'lib/git/object.rb', line 232
def commit?
true
end
|
[View source]
209
210
211
212
|
# File 'lib/git/object.rb', line 209
def committer
check_commit
@committer
end
|
permalink
#committer_date
Also known as:
date
[View source]
214
215
216
|
# File 'lib/git/object.rb', line 214
def committer_date
committer.date
end
|
[View source]
219
220
221
|
# File 'lib/git/object.rb', line 219
def diff_parent
diff(parent)
end
|
[View source]
183
184
185
186
|
# File 'lib/git/object.rb', line 183
def gtree
check_commit
Tree.new(@base, @tree)
end
|
[View source]
174
175
176
177
|
# File 'lib/git/object.rb', line 174
def message
check_commit
@message
end
|
[View source]
179
180
181
|
# File 'lib/git/object.rb', line 179
def name
@base.lib.name_rev(sha)
end
|
[View source]
188
189
190
|
# File 'lib/git/object.rb', line 188
def parent
parents.first
end
|
array of all parent commits
[View source]
193
194
195
196
|
# File 'lib/git/object.rb', line 193
def parents
check_commit
@parents
end
|
[View source]
223
224
225
226
227
228
229
230
|
# File 'lib/git/object.rb', line 223
def set_commit(data)
@sha ||= data['sha']
@committer = Git::Author.new(data['committer'])
@author = Git::Author.new(data['author'])
@tree = Git::Object::Tree.new(@base, data['tree'])
@parents = data['parent'].map{ |sha| Git::Object::Commit.new(@base, sha) }
@message = data['message'].chomp
end
|