summaryrefslogtreecommitdiff
path: root/lib/gitlab/git/repository.rb
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-07-07 18:19:06 +0100
committerPhil Hughes <me@iamphill.com>2017-07-07 18:19:06 +0100
commit436047f6575ffc64f065928d1feb4144ca8f7158 (patch)
treecde5492d734968a0a9c96baccc74a408d3d991b5 /lib/gitlab/git/repository.rb
parentc70bf95c2a5cc0bd8a70d8b65fc678ee1c631420 (diff)
parent1dab640357fa1ba8992757499e4167fcd4ce6276 (diff)
downloadgitlab-ce-436047f6575ffc64f065928d1feb4144ca8f7158.tar.gz
Merge branch 'master' into new-nav-fix-contextual-breadcrumbs
Diffstat (limited to 'lib/gitlab/git/repository.rb')
-rw-r--r--lib/gitlab/git/repository.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index dd5a4d5ad55..e51966313d4 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -568,11 +568,17 @@ module Gitlab
# Return total commits count accessible from passed ref
def 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
+ gitaly_migrate(:commit_count) do |is_enabled|
+ if is_enabled
+ gitaly_commit_client.commit_count(ref)
+ else
+ walker = Rugged::Walker.new(rugged)
+ walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE)
+ oid = rugged.rev_parse_oid(ref)
+ walker.push(oid)
+ walker.count
+ end
+ end
end
# Sets HEAD to the commit specified by +ref+; +ref+ can be a branch or