class Gitlab::Git::GitStats

Attributes

ref[RW]
repo[RW]

Public Class Methods

new(repo, ref) click to toggle source
# File lib/gitlab_git/git_stats.rb, line 8
def initialize repo, ref
  @repo, @ref = repo, ref
end

Public Instance Methods

log() click to toggle source
# File lib/gitlab_git/git_stats.rb, line 12
def log
  log = nil
  Grit::Git.with_timeout(30) do
    # Limit log to 6k commits to avoid timeout for huge projects
    args = [ref, '-6000', '--format=%aN%x0a%aE%x0a%cd', '--date=short', '--shortstat', '--no-merges', '--diff-filter=ACDM']
    log = repo.git.run(nil, 'log', nil, {}, args)
  end

  log
rescue Grit::Git::GitTimeout
  nil
end
parsed_log() click to toggle source
# File lib/gitlab_git/git_stats.rb, line 25
def parsed_log
  LogParser.parse_log(log)
end