summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2017-12-27 14:16:24 +0100
committerAhmad Sherif <me@ahmadsherif.com>2017-12-27 14:16:24 +0100
commit13932b0b12c91e9ddc17e0bbf3d7afa44b5e3fb1 (patch)
treeff8d0c5a508df47d9b7ab32d512714c53ec8ba4a /lib
parentaf490ea87b20bfa5062bf661abdeff9012d5884a (diff)
downloadgitlab-ce-13932b0b12c91e9ddc17e0bbf3d7afa44b5e3fb1.tar.gz
Add support for max_count option to Git::Repository#count_commitsfeature/add-max-count-to-count-commits-rpc
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git/repository.rb1
-rw-r--r--lib/gitlab/gitaly_client/commit_service.rb1
2 files changed, 2 insertions, 0 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 36dc6b820ce..9a064786eab 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -1661,6 +1661,7 @@ module Gitlab
cmd = %W[#{Gitlab.config.git.bin_path} --git-dir=#{path} rev-list]
cmd << "--after=#{options[:after].iso8601}" if options[:after]
cmd << "--before=#{options[:before].iso8601}" if options[:before]
+ cmd << "--max-count=#{options[:max_count]}" if options[:max_count]
cmd += %W[--count #{options[:ref]}]
cmd += %W[-- #{options[:path]}] if options[:path].present?
diff --git a/lib/gitlab/gitaly_client/commit_service.rb b/lib/gitlab/gitaly_client/commit_service.rb
index fb3e27770b4..dad0ea1927f 100644
--- a/lib/gitlab/gitaly_client/commit_service.rb
+++ b/lib/gitlab/gitaly_client/commit_service.rb
@@ -128,6 +128,7 @@ module Gitlab
request.after = Google::Protobuf::Timestamp.new(seconds: options[:after].to_i) if options[:after].present?
request.before = Google::Protobuf::Timestamp.new(seconds: options[:before].to_i) if options[:before].present?
request.path = options[:path] if options[:path].present?
+ request.max_count = options[:max_count] if options[:max_count].present?
GitalyClient.call(@repository.storage, :commit_service, :count_commits, request, timeout: GitalyClient.medium_timeout).count
end