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

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Okstad <pokstad@gitlab.com>2019-02-28 22:24:41 +0300
committerPaul Okstad <pokstad@gitlab.com>2019-02-28 22:24:41 +0300
commit96b61ee054553af78f564eec5a0f7d839a3d50d1 (patch)
tree1229d7eacfdea852434003c96ebf3d6886adaf08
parent63c0b18c76e88ae21bab79749e7efa21431ad907 (diff)
parent8f301f32d7357f06c01b4cda47ea1fc527e13e48 (diff)
Merge branch 'jc-remove-ruby-find-commits' into 'master'
Remove ruby implementation of find commits Closes #1448 See merge request gitlab-org/gitaly!1099
-rw-r--r--changelogs/unreleased/jc-remove-ruby-find-commits.yml5
-rw-r--r--ruby/lib/gitaly_server/commit_service.rb27
-rw-r--r--ruby/lib/gitlab/git/repository.rb53
3 files changed, 5 insertions, 80 deletions
diff --git a/changelogs/unreleased/jc-remove-ruby-find-commits.yml b/changelogs/unreleased/jc-remove-ruby-find-commits.yml
new file mode 100644
index 000000000..7d29cb540
--- /dev/null
+++ b/changelogs/unreleased/jc-remove-ruby-find-commits.yml
@@ -0,0 +1,5 @@
+---
+title: Remove ruby implementation of find commits
+merge_request: 1099
+author:
+type: other
diff --git a/ruby/lib/gitaly_server/commit_service.rb b/ruby/lib/gitaly_server/commit_service.rb
index 73d4c06b1..434bcad7a 100644
--- a/ruby/lib/gitaly_server/commit_service.rb
+++ b/ruby/lib/gitaly_server/commit_service.rb
@@ -3,33 +3,6 @@ module GitalyServer
include Utils
include Gitlab::EncodingHelper
- def find_commits(request, call)
- repository = Gitlab::Git::Repository.from_gitaly(request.repository, call)
- options = {
- ref: request.revision,
- limit: request.limit,
- follow: request.follow,
- skip_merges: request.skip_merges,
- disable_walk: request.disable_walk,
- offset: request.offset,
- all: request.all
- }
- options[:path] = request.paths unless request.paths.empty?
-
- options[:before] = Time.at(request.before.seconds).to_datetime if request.before
- options[:after] = Time.at(request.after.seconds).to_datetime if request.after
-
- Enumerator.new do |y|
- # Send back 'pages' with 20 commits each
- repository.raw_log(options).each_slice(20) do |rugged_commits|
- commits = rugged_commits.map do |rugged_commit|
- gitaly_commit_from_rugged(rugged_commit)
- end
- y.yield Gitaly::FindCommitsResponse.new(commits: commits)
- end
- end
- end
-
def filter_shas_with_signatures(_session, call)
Enumerator.new do |y|
repository = nil
diff --git a/ruby/lib/gitlab/git/repository.rb b/ruby/lib/gitlab/git/repository.rb
index dedbe368f..8576ee8c4 100644
--- a/ruby/lib/gitlab/git/repository.rb
+++ b/ruby/lib/gitlab/git/repository.rb
@@ -573,21 +573,6 @@ module Gitlab
end
end
- def raw_log(options)
- sha =
- unless options[:all]
- actual_ref = options[:ref] || root_ref
- begin
- sha_from_ref(actual_ref)
- rescue Rugged::OdbError, Rugged::InvalidError, Rugged::ReferenceError
- # Return an empty array if the ref wasn't found
- return []
- end
- end
-
- log_by_shell(sha, options)
- end
-
def with_repo_branch_commit(start_repository, start_branch_name)
Gitlab::Git.check_namespace!(start_repository)
start_repository = RemoteRepository.new(start_repository) unless start_repository.is_a?(RemoteRepository)
@@ -910,44 +895,6 @@ module Gitlab
sort_branches(branches, sort_by)
end
- def log_by_shell(sha, options)
- limit = options[:limit].to_i
- offset = options[:offset].to_i
- use_follow_flag = options[:follow] && options[:path].present?
-
- # We will perform the offset in Ruby because --follow doesn't play well with --skip.
- # See: https://gitlab.com/gitlab-org/gitlab-ce/issues/3574#note_3040520
- offset_in_ruby = use_follow_flag && options[:offset].present?
- limit += offset if offset_in_ruby
-
- cmd = %w[log]
- cmd << "--max-count=#{limit}"
- cmd << '--format=%H'
- cmd << "--skip=#{offset}" unless offset_in_ruby
- cmd << '--follow' if use_follow_flag
- cmd << '--no-merges' if options[:skip_merges]
- cmd << "--after=#{options[:after].iso8601}" if options[:after]
- cmd << "--before=#{options[:before].iso8601}" if options[:before]
-
- if options[:all]
- cmd += %w[--all --reverse]
- else
- cmd << sha
- end
-
- # :path can be a string or an array of strings
- if options[:path].present?
- cmd << '--'
- cmd += Array(options[:path])
- end
-
- # Disable stderr because Git can show warnings that corrupt the output stream
- raw_output, _status = run_git(cmd, include_stderr: false)
- lines = offset_in_ruby ? raw_output.lines.drop(offset) : raw_output.lines
-
- lines.map! { |c| Rugged::Commit.new(rugged, c.strip) }
- end
-
def build_git_cmd(*args)
object_directories = alternate_object_directories.join(File::PATH_SEPARATOR)