Class: Gitlab::Git::GitStats
- Inherits:
-
Object
- Object
- Gitlab::Git::GitStats
- Defined in:
- lib/gitlab_git/git_stats.rb
Instance Attribute Summary collapse
-
#ref ⇒ Object
Returns the value of attribute ref.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize(repo, ref, timeout = 30) ⇒ GitStats
constructor
A new instance of GitStats.
- #log ⇒ Object
- #parsed_log ⇒ Object
Constructor Details
#initialize(repo, ref, timeout = 30) ⇒ GitStats
Returns a new instance of GitStats.
8 9 10 |
# File 'lib/gitlab_git/git_stats.rb', line 8 def initialize(repo, ref, timeout = 30) @repo, @ref, @timeout = repo, ref, timeout end |
Instance Attribute Details
#ref ⇒ Object
Returns the value of attribute ref.
6 7 8 |
# File 'lib/gitlab_git/git_stats.rb', line 6 def ref @ref end |
#repo ⇒ Object
Returns the value of attribute repo.
6 7 8 |
# File 'lib/gitlab_git/git_stats.rb', line 6 def repo @repo end |
#timeout ⇒ Object
Returns the value of attribute timeout.
6 7 8 |
# File 'lib/gitlab_git/git_stats.rb', line 6 def timeout @timeout end |
Instance Method Details
#log ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/gitlab_git/git_stats.rb', line 12 def log log = nil Grit::Git.with_timeout(timeout) 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 |