Sha256: 76b3eee41c99735d60fc36ebe0d0376c0f8bb924e1982aa141570b01a3cc2dfa

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

require_relative 'log_parser'

module Gitlab
  module Git
    class GitStats
      attr_accessor :repo, :ref

      def initialize repo, ref
        @repo, @ref = repo, ref
      end

      def log
        log = nil
        Grit::Git.with_timeout(15) do
          # Limit log to 8k commits to avoid timeout for huge projects
          args = ['-8000', '--format=%aN%x0a%aE%x0a%cd', '--date=short', '--shortstat', '--no-merges']
          log = repo.git.run(nil, 'log', nil, {}, args)
        end

        log
      rescue Grit::Git::GitTimeout
        nil
      end

      def parsed_log
        LogParser.parse_log(log)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitlab_git-2.0.1 lib/gitlab_git/git_stats.rb