Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2018-06-28 14:41:59 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2018-06-28 14:42:10 +0300
commitec78d29a6eee9b91299cbaef4e7497f392af0310 (patch)
treea7671faa17bd9463fd62637c29b076ae43562698 /lib/gitlab/git/commit.rb
parenteaa9d4fd75252861bb733951b7571d7aea66fd66 (diff)
FindAllCommits mandatory
Closes https://gitlab.com/gitlab-org/gitaly/issues/326
Diffstat (limited to 'lib/gitlab/git/commit.rb')
-rw-r--r--lib/gitlab/git/commit.rb51
1 files changed, 2 insertions, 49 deletions
diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb
index 01274505557..fb35f1d99be 100644
--- a/lib/gitlab/git/commit.rb
+++ b/lib/gitlab/git/commit.rb
@@ -149,58 +149,11 @@ module Gitlab
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/326
def find_all(repo, options = {})
- Gitlab::GitalyClient.migrate(:find_all_commits) do |is_enabled|
- if is_enabled
- find_all_by_gitaly(repo, options)
- else
- find_all_by_rugged(repo, options)
- end
+ repo.wrapped_gitaly_errors do
+ Gitlab::GitalyClient::CommitService.new(repo).find_all_commits(options)
end
end
- def find_all_by_rugged(repo, options = {})
- actual_options = options.dup
-
- allowed_options = [:ref, :max_count, :skip, :order]
-
- actual_options.keep_if do |key|
- allowed_options.include?(key)
- end
-
- default_options = { skip: 0 }
- actual_options = default_options.merge(actual_options)
-
- rugged = repo.rugged
- walker = Rugged::Walker.new(rugged)
-
- if actual_options[:ref]
- walker.push(rugged.rev_parse_oid(actual_options[:ref]))
- else
- rugged.references.each("refs/heads/*") do |ref|
- walker.push(ref.target_id)
- end
- end
-
- walker.sorting(rugged_sort_type(actual_options[:order]))
-
- commits = []
- offset = actual_options[:skip]
- limit = actual_options[:max_count]
- walker.each(offset: offset, limit: limit) do |commit|
- commits.push(decorate(repo, commit))
- end
-
- walker.reset
-
- commits
- rescue Rugged::OdbError
- []
- end
-
- def find_all_by_gitaly(repo, options = {})
- Gitlab::GitalyClient::CommitService.new(repo).find_all_commits(options)
- end
-
def decorate(repository, commit, ref = nil)
Gitlab::Git::Commit.new(repository, commit, ref)
end