Commit 77032638 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'gitaly-1215-ca-count-commits' into 'master'

Migrate CycleAnalytics::CommitCount to Gitaly

Closes gitaly#1215

See merge request gitlab-org/gitlab-ce!19481
parents a20d3ff2 1d50b6a4
...@@ -7,10 +7,8 @@ module Gitlab ...@@ -7,10 +7,8 @@ module Gitlab
end end
def value def value
Gitlab::GitalyClient::StorageSettings.allow_disk_access do
@value ||= count_commits @value ||= count_commits
end end
end
private private
...@@ -21,19 +19,11 @@ module Gitlab ...@@ -21,19 +19,11 @@ module Gitlab
def count_commits def count_commits
return unless ref return unless ref
repository = @project.repository.raw_repository gitaly_commit_client.commit_count(ref, after: @from)
sha = @project.repository.commit(ref).sha end
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?
output.lines.count def gitaly_commit_client
Gitlab::GitalyClient::CommitService.new(@project.repository.raw_repository)
end end
def ref def ref
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment