in lib/rugged_adapter/git_layer_rugged.rb [320:353]
def build_log(sha, options)
walker = Rugged::Walker.new(@repo)
walker.push(sha)
commits = []
skipped = 0
current_path = options[:path].dup if options[:path]
current_path = nil if current_path == ''
renamed_path = current_path.nil? ? nil : current_path.dup
track_pathnames = true if current_path && options[:follow]
limit = options[:limit].to_i
offset = options[:offset].to_i
skip_merges = options[:skip_merges]
walker.sorting(Rugged::SORT_DATE)
walker.each do |c|
break if limit > 0 && commits.length >= limit
if skip_merges
next if c.parents.length > 1
end
if !current_path || commit_touches_path?(c, current_path, options[:follow], walker)
skipped += 1
commits.push(Gollum::Git::Commit.new(c, track_pathnames ? renamed_path : nil)) if skipped > offset
renamed_path = current_path.nil? ? nil : current_path.dup
end
end
walker.reset
commits
end