blob: fab605e8ab7f96d8664b1031c75f72cf56f5fe2a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
module Git
# object that holds the last X commits on given branch
class Log
include Enumerable
@base = nil
@commits = nil
def initialize(base, count = 30)
@base = base
@commits = @base.lib.log_shas(count)
end
def size
@commits.size
end
def each
@commits.each do |c|
yield c
end
end
def first
@commits.first
end
def to_s
self.map { |c| c.sha }.join("\n")
end
end
end
|