Skip to content

Commit 4965154

Browse files
hotchpotchschacon
authored andcommitted
add skip options.
usage: git.log(30).skip(10).to_a Signed-off-by: Scott Chacon <schacon@gmail.com>
1 parent 29cbae7 commit 4965154

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/git/lib.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def log_commits(opts = {})
8080
def full_log_commits(opts = {})
8181
arr_opts = ['--pretty=raw']
8282
arr_opts << "-#{opts[:count]}" if opts[:count]
83+
arr_opts << "--skip=\"#{opts[:skip]}\"" if opts[:skip]
8384
arr_opts << "--since=\"#{opts[:since]}\"" if opts[:since].is_a? String
8485
arr_opts << "--until=\"#{opts[:until]}\"" if opts[:until].is_a? String
8586
arr_opts << "--grep=\"#{opts[:grep]}\"" if opts[:grep].is_a? String

lib/git/log.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Log
1111
@path = nil
1212
@count = nil
1313
@since = nil
14+
@skip = nil
1415
@until = nil
1516
@between = nil
1617

@@ -46,6 +47,12 @@ def path(path)
4647
return self
4748
end
4849

50+
def skip(num)
51+
dirty_log
52+
@skip = num
53+
return self
54+
end
55+
4956
def since(date)
5057
dirty_log
5158
@since = date
@@ -103,11 +110,11 @@ def check_log
103110
def run_log
104111
log = @base.lib.full_log_commits(:count => @count, :object => @object,
105112
:path_limiter => @path, :since => @since,
106-
:author => @author, :grep => @grep,
113+
:author => @author, :grep => @grep, :skip => @skip,
107114
:until => @until, :between => @between)
108115
@commits = log.map { |c| Git::Object::Commit.new(@base, c['sha'], c) }
109116
end
110117

111118
end
112119

113-
end
120+
end

0 commit comments

Comments
 (0)