Commit 9e82c32b authored by Douwe Maan's avatar Douwe Maan

Merge branch 'zj-commit-count' into 'master'

Move count commit to mandatory

Closes gitaly#330

See merge request gitlab-org/gitlab-ce!19984
parents 7a42d865 6e25935f
......@@ -676,15 +676,9 @@ module Gitlab
end
# Return total commits count accessible from passed ref
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/330
def commit_count(ref)
gitaly_migrate(:commit_count, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
if is_enabled
wrapped_gitaly_errors do
gitaly_commit_client.commit_count(ref)
else
rugged_commit_count(ref)
end
end
end
......@@ -2383,16 +2377,6 @@ module Gitlab
nil
end
def rugged_commit_count(ref)
walker = Rugged::Walker.new(rugged)
walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE)
oid = rugged.rev_parse_oid(ref)
walker.push(oid)
walker.count
rescue Rugged::ReferenceError
0
end
def rev_list_param(spec)
spec == :all ? ['--all'] : spec
end
......
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