diff options
author | Kim Carlbäcker <kim.carlbacker@gmail.com> | 2018-06-11 15:59:11 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-06-11 15:59:11 +0300 |
commit | 1d50b6a4adefee8220914c2e56b5ba5f7ee635e7 (patch) | |
tree | 8272136711438102cefe915fdc99177bc19f3d0c /lib | |
parent | a20d3ff2b004e8ab62c037d1a7b9018dcb402913 (diff) |
Migrate CycleAnalytics::CommitCount to Gitaly
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/cycle_analytics/summary/commit.rb | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/gitlab/cycle_analytics/summary/commit.rb b/lib/gitlab/cycle_analytics/summary/commit.rb index 0a88e052f60..550c1755a71 100644 --- a/lib/gitlab/cycle_analytics/summary/commit.rb +++ b/lib/gitlab/cycle_analytics/summary/commit.rb @@ -7,9 +7,7 @@ module Gitlab end def value - Gitlab::GitalyClient::StorageSettings.allow_disk_access do - @value ||= count_commits - end + @value ||= count_commits end private @@ -21,19 +19,11 @@ module Gitlab def count_commits return unless ref - repository = @project.repository.raw_repository - sha = @project.repository.commit(ref).sha - - cmd = %W(git --git-dir=#{repository.path} log) - cmd << '--format=%H' - cmd << "--after=#{@from.iso8601}" - cmd << sha - - output, status = Gitlab::Popen.popen(cmd) - - raise IOError, output unless status.zero? + gitaly_commit_client.commit_count(ref, after: @from) + end - output.lines.count + def gitaly_commit_client + Gitlab::GitalyClient::CommitService.new(@project.repository.raw_repository) end def ref |