in lib/grit/git-ruby/repository.rb [327:393]
def walk_log(sha, opts, total_size = 0)
return [] if @already_searched[sha]
@already_searched[sha] = true
array = []
if (sha)
o = get_raw_object_by_sha1(sha)
if o.type == :tag
commit_sha = get_object_by_sha1(sha).object
c = get_object_by_sha1(commit_sha)
else
c = GitObject.from_raw(o)
end
return [] if c.type != :commit
add_sha = true
if opts[:since] && opts[:since].is_a?(Time) && (opts[:since] > c.committer.date)
add_sha = false
end
if opts[:until] && opts[:until].is_a?(Time) && (opts[:until] < c.committer.date)
add_sha = false
end
subarray = []
if !c.parent.first && opts[:path_limiter]
add_sha = false
end
if (!opts[:max_count] || ((array.size + total_size) < opts[:max_count]))
if !opts[:path_limiter]
output = c.raw_log(sha)
array << [sha, output, c.committer.date]
end
if (opts[:max_count] && (array.size + total_size) >= opts[:max_count])
return array
end
c.parent.each do |psha|
if psha && !files_changed?(c.tree, get_object_by_sha1(psha).tree,
opts[:path_limiter])
add_sha = false
end
subarray += walk_log(psha, opts, (array.size + total_size))
next if opts[:first_parent]
end
if opts[:path_limiter] && add_sha
output = c.raw_log(sha)
array << [sha, output, c.committer.date]
end
if add_sha
array += subarray
end
end
end
array
end